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
| # This file should be copy and pastable in bash or zsh. | |
| # Homebrew uses this version as of this documentation's writing. | |
| export POSTGRESQL_VERSION="2.1.3" | |
| # 1. Install PostgreSQL postgis and postgres | |
| brew install postgis | |
| initdb /usr/local/var/postgres | |
| ## Start up the database. You can also use the launchctl method. |
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 CreateCountries < ActiveRecord::Migration | |
| def change | |
| create_table :countries do |t| | |
| t.string :name | |
| t.string :iso_code | |
| t.multi_polygon :geom | |
| t.timestamps | |
| 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
| TEXT = <<EOF | |
| See, the interesting thing about this text | |
| is that while it seems like the first line defines an indent | |
| it's actually the last line which has the smallest indent | |
| there are also some blank lines | |
| both with and without extra spaces in them | |
| and it just goes on and on |
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 './zoltar_module' | |
| require './zoltar_helper' | |
| include ZoltarSpeaks | |
| intro | |
| greeting | |
| shall_we | |
| which_fortune | |
| answer = promptd |
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
| ##votersim.rb | |
| class Person | |
| attr_accessor :voters, :politicians | |
| def initialize | |
| @@voters = [] | |
| @@politicians = [] | |
| 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
| require 'httparty' | |
| require 'json' | |
| # Use this in Rails | |
| # rails g model report date:datetime count:integer | |
| # rails db:migrate | |
| # Because this isn't Rails | |
| class Report | |
| attr_accessor :date, :count |
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 "benchmark/ips" | |
| def some_long_operation(digit) | |
| "Hello #{digit}" | |
| end | |
| def algorithm1(n) | |
| %w/Hello Goodbye Greetings Hi Yo Hey/.each do |greeting| | |
| count = 0; | |
| n.times 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
| puts <<EOP | |
| This is kinda cool | |
| for | |
| typing | |
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 Batman | |
| def display_choices | |
| puts <<-END | |
| What do you want to do? | |
| Options: #{yield} | |
| Enter the letter corresponding to your choice. | |
| END | |
| end | |
| def display_intro |
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 Animal | |
| def move | |
| "Move, move" | |
| end | |
| def make_noise | |
| "Making noise" | |
| end | |
| end |