This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="lesson"><span>Lists of Instructions</span> | |
| <div><span>A to-do list, not a shopping list</span> | |
| <p>When I say that computers follow lists of instructions, I mean a to-do list, not a shopping list. What I'm trying to say is that these lists have an <strong>order</strong> to them that the computer follows. It does each step in turn as quickly as it possibly can.</p> | |
| <p>A shopping list is a different kind of list entirely. You can go to whichever aisle you choose, and as long as you get everything before you leave, you're A-OK. This isn't what the computer does at all.</p> | |
| </div> | |
| <div><span>How would you tell a person to do it?</span> | |
| <p>Let's try an example: if you had to tell someone in words how to draw a square on a piece of paper, how would you do it?</p> | |
| <p>You're not allowed to say "like this" or "this way," that's cheating! You have to spell out every detail.</p> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from the irb source code | |
| module HH::InputCompletor | |
| ReservedWords = [ | |
| "BEGIN", "END", | |
| "alias", "and", | |
| "begin", "break", | |
| "case", "class", | |
| "def", "defined", "do", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hoptoad_deploy_environments = %w(staging production) | |
| if hoptoad_deploy_environments.include?(@configuration[:environment]) | |
| # Notify Hoptoad of deploy | |
| run "cd #{current_path} && rake hoptoad:deploy TO=#{@configuration[:environment]} REVISION=#{@configuration[:revision]} REPO=#{@configuration[:repository]}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Color | |
| "The fundamental uses of color in information design (are): to label, to measure, to represent or imitate reality, to enliven or decorate." Dr. Tufte provides a few specific guidelines on the use of color: | |
| "Color spots against a light gray or muted field highlight and italicize data." "Note the effectiveness and elegance of small spots of intense, saturated color for carrying information." | |
| "use colors found in nature, especially those on the lighter side." | |
| "For encoding information,... more than 20 or 30 colors frequently produce not diminishing but negative returns." | |
| "The primary colors (yellow, red, blue) and black provides maximum differentiation (no four colors differ more)." | |
| In color maps, use a single hue, Don't use up the entire color spectrum, or even all of a hue's levels. Particularly avoid Roy G. Biv (red, orange, yellow, green, blue, indigo, violet), the color spectrum of the rainbow. It's good physics, but poor human factors. Like all multi-hue color maps, the non-equidistant hue changes a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| button.addEventListener('click', function() | |
| { | |
| var xhr = Titanium.Network.createHTTPClient(); | |
| xhr.onerror = function(e) | |
| { | |
| alert("ERROR " + e.error) | |
| } | |
| xhr.onload = function() | |
| { | |
| label.hide(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| image_tag(time_spent_user_path(current_user, :format => 'png')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GET /user/1/time_spent | |
| def time_spent | |
| @time_spent = @user.time_spent | |
| respond_to do |format| | |
| format.xml { render :xml => @time_spent.to_xml } | |
| format.json { render :json => @time_spent.to_json } | |
| format.png { send_data(Spark.plot( @time_spent, :has_min => true, :has_max => true, 'has_last' => 'true', 'height' => '30', :step => 10 ), :type => 'image/png', | |
| :filename => "#{@user.login}_time_spent.png", | |
| :disposition => 'inline') } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| P1 -> propeller(:motor) | |
| P2 -> led | |
| P3, P4 <-> xbee(:serial) | |
| P6 <- button(:button) | |
| P7 <- thermometer(:analog) | |
| every 100ms do | |
| if button.pushed | |
| led.off | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) 2005 David Heinemeier Hansson | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining | |
| # a copy of this software and associated documentation files (the | |
| # "Software"), to deal in the Software without restriction, including | |
| # without limitation the rights to use, copy, modify, merge, publish, | |
| # distribute, sublicense, and/or sell copies of the Software, and to | |
| # permit persons to whom the Software is furnished to do so, subject to | |
| # the following conditions: | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if verify_recaptcha(@thing) && @thing.save! | |
| redirect_to success_path | |
| else | |
| render :action => 'new' # error shown in view | |
| end |