This file contains 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
grunt.registerTask('cloudfront:invalidate', 'invalidate lib on cloudfront', function() { | |
var finished = this.async(), | |
aws = require('aws-sdk'), | |
path = '/libs/ll.sdk-' + sdk_version + '.js' | |
; | |
// set aws keys & region from config | |
aws.config.update({ |
This file contains 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 will force ActiveRecord to create proper `interval` column types in PostgreSQL | |
# | |
# def change | |
# add_column :leases, :period, :interval | |
# end | |
# | |
# This applies to a generated `schema.rb` file too. | |
# | |
# No special OID type is applied to an `interval` type. Rails will treat it as a string, although |
This file contains 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
package 'postgresql-server-dev-9.2' | |
package 'postgresql-contrib-9.2' | |
# without hstore this won't build without fiddling, so it's easiest just to install hstore too | |
bash 'build_json_enhancements' do | |
code <<-CODE | |
cd /var/cache/chef | |
wget https://bitbucket.org/qooleot/json_enhancements/get/master.tar.gz | |
tar -xvzf master.tar.gz |
This file contains 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
knife ssh 'name:*' 'uptime' -G user@gateway.example.com -a private_ipaddress -x user | |
# to run chef-client on all servers: | |
knife ssh 'name:*' 'sudo chef-client' -G user@gateway.example.com -a private_ipaddress -x user |
This file contains 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 provides `create_enum` and `drop_enum` methods for migrations, which creates | |
# a Postgres ENUM type with the provided values. | |
# | |
# It'll also dump these into the schema.rb to be loaded into another DB (e.g. rake db:test:load) | |
# | |
# In order to reference the new enums as actual types, ActiveRecord needs to know about them, so | |
# make sure they are all represented in the `types` array below | |
# | |
# Then you can reference them in your migrations, e.g. |
This file contains 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 PgSequence | |
module PostgreSQLAdapter | |
def create_sequence(name) | |
execute "CREATE SEQUENCE #{name}" | |
end | |
def drop_sequence(name) | |
execute "DROP SEQUENCE #{name}" | |
end | |
end |
This file contains 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
var browser = new Browser(); | |
browser.visit('/hello', function() { | |
// do some checks | |
// I'm not sure if browser.resources is an official part of the Zombie API (I found it by searching the src) | |
// so be wary in case it changes | |
browser.resources.post( | |
'/authenticate?email=hello@example.com&password=' + auth_token, |
This file contains 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
line = '127.0.0.1 gateway.internal gateway' | |
file = Chef::Util::FileEdit.new('/etc/hosts') | |
file.insert_line_if_no_match(/#{line}/, line) | |
file.write_file |
This file contains 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
toggleUserMenu: (e) -> | |
e.preventDefault() if e | |
container = @$('.user') | |
# remove body listener if present | |
$('body').off 'click.menu' | |
$('.menu', container).toggleClass('visible') | |
container.toggleClass('open') |
This file contains 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
$('.logout').on 'click', (e) -> | |
link = $(e.currentTarget) | |
csrf_token = $('meta[name="csrf-token"]').attr('content') | |
form = $('<form>') | |
form.hide() | |
form.attr('method', 'post').attr('action', link.attr('href')) | |
$("<input type='hidden' name='authenticity_token' value='#{csrf_token}'>").appendTo(form) |