I hereby claim:
- I am n3bulous on github.
- I am kmcfadden (https://keybase.io/kmcfadden) on keybase.
- I have a public key ASDsqs5_YHvYC13MGy9GZzANdPeNvMwv96qfGUokvTR7kAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Sometimes you need to iterate over a ton of items and you don't want the overhead of creating AR objects out of all of them. Hell, you only need a few things! Well, #pluck has your back.
But what if you want to iterate over many tonnes of items?
Pluck in batches to the rescue!
This fork works on any orderable primary key not just integers just like http://api.rubyonrails.org/classes/ActiveRecord/Batches.html#method-i-find_in_batches
class AddEnvironmentToHost < ActiveRecord::Migration | |
def self.up | |
- add_column :hosts, :environment, :string | |
+ unless ActiveRecord::Base.connection.columns(:hosts).collect {|c| c.name}.include?("environment") | |
+ add_column :hosts, :environment, :string | |
+ end | |
end | |
def self.down | |
- remove_column :hosts, :environment |
An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.
Where:
REGION
: AWS region.ACCOUNT_ID
: AWS account ID.APPLICATION_NAME
: Desired target Elastic Beanstalk application name(space).IAM_INSTANCE_PROFILE_ROLE
: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.DELIMITER | | |
CREATE FUNCTION uuid_from_bin(b BINARY(16)) | |
RETURNS CHAR(36) DETERMINISTIC | |
BEGIN | |
DECLARE hex CHAR(32); | |
SET hex = HEX(b); | |
RETURN LOWER(CONCAT(LEFT(hex, 8), '-', MID(hex, 9,4), '-', MID(hex, 13,4), '-', MID(hex, 17,4), '-', RIGHT(hex, 12))); | |
END | |
| |
#!/bin/bash | |
# | |
# The MIT License | |
# | |
# Copyright 2014 Jakub Jirutka <jakub@jirutka.cz>. | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
I hereby claim:
To claim this, I am signing this object:
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
# An example of the below | |
virtualenv "/home/dvcsmirrors/hg" do | |
owner "root" | |
group "dvcsmirrors" | |
mode 0775 | |
packages "Mercurial" => "1.6.3", | |
"hgsubversion" => "1.1.2" | |
end |
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY! | |
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
# | |
# Deployment structure | |
# | |
# SERVER: | |
# /etc/init.d/nginx (1. nginx) | |
# /home/app/public_html/app_production/current (Capistrano directory) | |
# |