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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <!-- Generated by: TmTheme-Editor --> | |
| <!-- ============================================ --> | |
| <!-- app: http://tmtheme-editor.herokuapp.com --> | |
| <!-- code: https://github.com/aziz/tmTheme-Editor --> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>author</key> | |
| <string>Anthony M. Cook</string> |
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
| text = "Give apple to Sam." | |
| regex = /^Give (?<fruit>.+?) to (?<person>.+?)\.$/ | |
| matchdata = text.match regex | |
| puts matchdata[:fruit] #=> apple | |
| puts matchdata[:person] #=> Sam |
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
| rvm use --install --create . |
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
| require 'pathname' | |
| require 'sinatra/base' | |
| module MyApp | |
| module_function | |
| def root | |
| Pathname.new(__FILE__).dirname | |
| end | |
| 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
| #!/usr/bin/env ruby | |
| file = File.new("test.wav", "r") | |
| puts "First position: #{file.pos}" | |
| char = file.getc | |
| puts "Got character: #{char}" | |
| file.pos |
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
| export INDEX=('1' '0') | |
| echo ${INDEX[1]} |
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 Game | |
| def initialize | |
| @player = Player.new | |
| @gui = GUI.new(self) | |
| end | |
| attr :player, :gui | |
| class Player | |
| attr_accessor :hit_points, :max_hit_points |
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
| begin; require 'rubygems'; rescue LoadError; end | |
| eng = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' | |
| gems = defined?(Gem) ? Gem.default_dir : "/usr/lib/#{eng}/gems/#{ver}" | |
| (RUBY_VERSION.split('.') + | |
| [RUBY_PATCHLEVEL, RUBY_REVISION, eng, RUBY_PLATFORM]). | |
| each_with_index { |v, i| puts "RUBY_VERINFO[#{i}]=#{v}" } | |
| puts "GEM_ROOT=#{gems}" |
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
| module MyModule | |
| def my_module_method | |
| puts "BOOYAH!!" | |
| end | |
| end | |
| Enumerable.send :include, MyModule | |
| Enumerable.instance_methods.include? :my_module_method | |
| #=> true |
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/bash | |
| # run this like: `curl https://gist.github.com/acook/6192391/raw/ubuntu_server_setup.bash | bash` | |
| echo "Enter the email address for this server's SSH key: " | |
| read email | |
| mkdir ~/.ssh | |
| ssh-keygen -t rsa -C $email | |
| echo "Enter password to install packages: " |