Skip to content

Instantly share code, notes, and snippets.

View allolex's full-sized avatar
🏠
Working from home

Damon Davison allolex

🏠
Working from home
View GitHub Profile
# 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.
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
@allolex
allolex / unindent.rb
Last active August 29, 2015 14:06 — forked from avdi/unindent.rb
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
require './zoltar_module'
require './zoltar_helper'
include ZoltarSpeaks
intro
greeting
shall_we
which_fortune
answer = promptd
##votersim.rb
class Person
attr_accessor :voters, :politicians
def initialize
@@voters = []
@@politicians = []
end
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
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
puts <<EOP
This is kinda cool
for
typing
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
class Animal
def move
"Move, move"
end
def make_noise
"Making noise"
end
end