Skip to content

Instantly share code, notes, and snippets.

View pote's full-sized avatar

pote pote

View GitHub Profile
ActiveRecord::Schema.define(:version => 20130203210553) do
create_table "people", :force => true do |t|
t.string :name
t.string :birthday
t.string :place_of_birth
t.string :blood_type
end
create_table :scientists, :force => true do |t|
ActiveRecord::Schema.define(:version => 20130203210553) do
create_table "people", :force => true do |t|
t.string :name
t.string :birthday
t.string :place_of_birth
t.string :blood_type
t.string :type # => Needed for the ORM to know which kind of object its dealing with.
#!/bin/bash -l
shopt -s nullglob
enqueue() {
for rev; do
echo -n "$rev" > "$(mktemp "$queuedir/$(date +%s).XXXXXX")"
done
}
@pote
pote / 1old.txt
Last active December 21, 2015 22:58
New vs old johnny-deps output and execution times.
▸ time curl -s https://raw.github.com/VividCortex/johnny-deps/v0.1.5/bin/johnny_deps | bash
github.com/VividCortex/robustly (download)
github.com/VividCortex/ewma (download)
Setting github.com/VividCortex/robustly to version v1.0
Previous HEAD position was aefdcf1... Update VividCortex link
HEAD is now at ec98a8c... Godeps utility
github.com/VividCortex/ewma (download)
Setting github.com/VividCortex/ewma to version v1.0
Previous HEAD position was a4d14fa... Update README.md
HEAD is now at 2f8aa97... Refactor package name
@pote
pote / cli.sh
Last active August 29, 2015 13:56
Adventure in variable scoping
Hyrule ~/code/tmp
▸ go run scoping.go
./scoping.go:14: variable is shadowed during return
@pote
pote / Gemfile
Created February 5, 2014 20:14
ruby versioning
gem 'nokogiri', :git => 'git://github.com/sparklemotion/nokogiri.git', :tag => 'v1.6.0'
@pote
pote / active_record_hack.rb
Created February 5, 2014 20:17
Single Table Inheritance
# Use in subclasses like:
# delegate_details :win_ratio, :tanning_time, to: :wrestling_details
def self.delegate_details(*attributes)
options = attributes.extract_options!
association_name = options.fetch(:to) {
raise ArgumentError.new "You must specify the name of the details association"
}
define_method association_name do
super() || send("build_#{association_name}")
---
- hosts: web
sudo: yes
accelerate: true
vars:
app_dir: "/var/www/the_application_name_goes_here"
server_env:
RACK_ENV: "production"
SSO_SALT: "esta no es la salt de verdad"
REDIS_URL: "redis://rest_of_url"
@pote
pote / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console