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 'rubygems' | |
| require 'httparty' | |
| require 'benchmark' | |
| require 'thread' | |
| class Google | |
| include HTTParty | |
| base_uri 'http://google.com' | |
| def self.benchmark |
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 Chef | |
| class Provider | |
| class File | |
| class Copy << Chef::Provider::File | |
| def compare_content | |
| checksum(@current_resource.path) == checksum(@new_resource.content) | |
| 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
| # a lot of people in ruby do this | |
| module Foo | |
| extend self | |
| def bar | |
| 'bar' | |
| end | |
| end | |
| Foo.bar |
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 Group | |
| module Error | |
| class Standard < StandardError; end | |
| class AlreadyAMember < Standard; end | |
| class NotPermittedToJoin < Standard; end | |
| end | |
| def join user | |
| raise Error::NotPermittedToJoin unless self.permitted?(user) | |
| raise Error::AlreadyAMember if self.member?(user) |
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 Devise | |
| module Models | |
| module Confirmable | |
| handle_asynchronously :send_confirmation_instructions | |
| end | |
| module Recoverable | |
| handle_asynchronously :send_reset_password_instructions | |
| 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
| <?php | |
| // quick and dirty argument parsing | |
| foreach ($argv as $arg) { | |
| if ($arg == '-f') { | |
| define('FOLLOW', true); | |
| } | |
| if ($arg == '-h') { | |
| define('HISTOGRAM', true); | |
| } |
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
| __________________________________________________ | |
| | | |
| | Node name: <%= node.name %> | |
| | Node arch: <%= node.kernel.machine %> | |
| <% if node.attribute?('ec2') %> | |
| | EC2 AMI: <%= node[:ec2][:ami_id] %> | |
| | EC2 Instance: <%= node[:ec2][:instance_id] %> | |
| | Size: <%= node[:ec2][:instance_type] %> | |
| | Public IP: <%= node[:ec2][:public_ipv4] %> | |
| | Private IP: <%= node[:ec2][:local_ipv4] %> |
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
| #!/bin/bash | |
| # | |
| # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box | |
| # http://wildfish.com | |
| # add the ubuntu gis ppa | |
| sudo apt-get -y install python-software-properties | |
| sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
| sudo apt-get update |
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
| #!/usr/bin/env ruby | |
| require 'net/http/persistent' | |
| require 'uri' | |
| require 'thread' | |
| USAGE = <<EOS | |
| Parse a Rails log file and send metrics to stathat | |
| export EMAIL=email |
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
| #!/bin/bash | |
| echo ; echo | |
| echo "Create test index" | |
| curl -XPUT localhost:9200/testindex?pretty=true | |
| echo ; echo | |
| echo "Insert doc 1" | |
| curl -XPUT http://localhost:9200/testindex/article/1?pretty=true -d '{ |