Discover gists
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
validates_presence_of :first_name, :last_name, :zip | |
validates_length_of :password, :within => 6..40, :if => :password_required? | |
validates_confirmation_of :password, :if => :password_required? | |
validates_length_of :login, :within => 2..50, :too_short => "email must be at least 2 characters", :too_long => "email is too long!" | |
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :message => "is not formatted properly" | |
validates_uniqueness_of :email, :case_sensitive => false, :message => "is already in the system" |
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
<?php | |
$qry_str = 'publisher=9284102052512106'; | |
$url = "http://api.indeed.com/ads/apisearch?". $qry_str . '&q=' . $_GET['q'] . '&l=' . $_GET['l']; | |
$ch = curl_init(); // initialize curl handle | |
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to | |
curl_setopt($ch, CURLOPT_FAILONERROR, true); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);// allow redirects | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return into a variable | |
//curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s | |
//curl_setopt($ch, CURLOPT_POST, true); // set POST method |
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
require 'spec_helper.rb' | |
describe "Migration" do | |
before do | |
@record = mock('record', {:name => 'Pete'}) | |
MyModel = mock('MyModel Class', {:count => 1, :find => [@record]}) | |
require 'my_migration' | |
@migration = MyMigration.new | |
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
ron-evanss-macbook-pro-15:mysql-plugin-test-app ron$ pool -v start | |
-- PoolParty cloud: MySql Plugin Test App | |
On ami-4bb05422 | |
Minimum instances: 1 | |
Maximum instances: 4 | |
Polling every: 30.seconds | |
Keypair: mysql-test | |
Access key: 0CT2X9HAFADR370JWN02 | |
size: m1.small | |
Monitors available: |
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
=begin rdoc | |
PoolParty plugin to install and configure mysql on any instance designated as a database instance. | |
Written by Ron Evans (http://deadprogrammersociety.com) | |
Features of the current plugin: | |
- Installs current Mysql | |
- Does live database backup to S3 once every hour | |
- If the instance goes down, will automatically bring up another one, and restore latest backup | |
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
ActiveRecord::Base.logger = Logger.new(STDERR) |
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(couchdb_btree_vs_dets). | |
-author('cooldaemon@gmail.com'). | |
-export([test/0, test/1]). | |
test() -> test(1000). | |
test(Count) -> | |
KVs = lists:map( | |
fun (N) -> {N, {foo, bar, baz}} end, | |
lists:seq(1, Count) |
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
class Date | |
def at_some_point(options = {}) | |
start_hour = options[:between] | |
end_hour = options[:and] | |
if start_hour && end_hour | |
hours = rand(end_hour) + start_hour | |
else | |
hours = rand(24) | |
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
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
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
javascript:(function(){%09var%20s=document.createElement('script');%09s.charset='UTF-8';%09s.language='javascript';%09s.type='text/javascript';%09var%20d=new%20Date;%09s.src='http://gist.github.com/raw/2618/48b132f9c6b80af3ed860f2631af1f607c6f05ec?'+d.getMilliseconds();%09document.body.appendChild(s);})() |