From the list at Free Programming Books, here are those I wish to consume.
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
| #!/usr/bin/env ruby | |
| # gem install sinatra --no-document | |
| # gem install github-markdown --no-document | |
| # usage: ruby markedown.rb then, in Nitrous, simply select 'Preview -> Port 3000' on the menu | |
| require 'sinatra' | |
| require 'github/markdown' | |
| # Set port for compatability with Nitrous.IO | |
| configure :development 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
| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| require 'json' | |
| print 'Github Username: ' | |
| username = gets.chomp | |
| # get gists | |
| puts 'Downloading gists list' | |
| gists_str = open("https://api.github.com/users/#{username}/gists").read |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Supporting code for "Nitrous.IO: Rails Development in the Cloud" which demonstrates Nitrous.io for Ruby on Rails development without regard to hardware or physical location. | |
| Full article at http://www.sitepoint.com/nitrous-io-rails-development-cloud/ |
When I first uncovered Collatz conjecture it made perfect sense to me. You are simply dividing an even number in half until you reach one and, if the number is not even you coerce it to be so.
This created a flash of inspiration for me to devise this simple routine.
{This could be used as the basis of a program to prove the "unsolved problem" of whether Collatz conjecture applies to ALL numbers greater than one.}
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
| # -*- coding: utf-8 -*- | |
| $:.unshift("/Library/RubyMotion/lib") | |
| require 'motion/project' | |
| # custom rake tasks | |
| require '../raketasks/gemerator.rb' | |
| desc "Open latest crash log" | |
| task :log do | |
| app = Motion::Project::App.config |
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
| class UILabel_Adjustable | |
| # Borrowed and modified the excellent example at http://www.11pixel.com/blog/28/resize-multi-line-text-to-fit-uilabel-on-iphone/ | |
| # adapting it for RubyMotion | |
| # This applies only to a multi-line label. You can use '.adjustsFontSizeToFitWidth = true' for a single-line label | |
| # usage is: | |
| # text = "It's bad luck to be superstitious" | |
| # text_label = UILabel.alloc.initWithFrame([[20, 20], [70, 120]]) | |
| # text_label.numberOfLines = 0 # set 0 for word wrap | |
| # text_label.lineBreakMode = UILineBreakModeWordWrap |
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
| # A generic class to encapsulate the simple UIAlertView capability in iOS | |
| # usage: | |
| # @alert = Alert.new { :title => "IMPORTANT ALERT", :message => "It is bad luck to be superstitious!"} | |
| # @alert.show | |
| class Alert | |
| attr_reader :dialog, :alert_message, :alert_title, :alert_acknowledge | |
| def initialize(params = {}) |
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
| Try this in the IRB console. | |
| >> testhash = { :key1 => 'val1', :key2 => 'val2', :key3 => 'val3' } | |
| >> testhash.each { | key, value | p key.to_s } | |
| >> testhash.each { | key | p key.to_s } | |
| My expectation was for the output to be the same in both cases. | |
| Why the difference? | |
| Why are the key and value concatenated? |
NewerOlder