Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Script created by
# Romeo-Adrian Cioaba romeo.cioaba@spotonearth.com
# Super minor updates by jason.melton[at]gmail[dot]com
# Updates by Alejandro Cuervo 3[at]cuervo[dot]net
# Released under GPL
echo "Closing Firefox"
sudo killall -9 firefox
(function($) {
$.extend({
mocker: {
sleeper: function() {},
ajax: function() {},
ajaxRequestData: {},
}
});
$.mocker.sleeper = function(milisecs, func) {
@mistersourcerer
mistersourcerer / db_migrate_all.rake
Created November 2, 2010 20:13
Migrate all environments
namespace :db do
desc "Migrate all enviroments"
namespace :migrate do
task :all do
#current_rails_env = Rails.env
db_config = YAML::load(File.read(File.join(Rails.root, "/config/database.yml")))
db_config.keys.each do |e|
#Rails.env = e
#Rake::Task['db:migrate'].invoke
puts "migrating: #{e}"
@mistersourcerer
mistersourcerer / gist:768117
Created January 6, 2011 16:29
toy blocks post, Objective-C, array sort
NSMutableArray *users = [NSMutableArray arrayWithArray:usersList];
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES];
[users sortUsingDescriptors:[NSArray arrayWithObject:sort]];
@mistersourcerer
mistersourcerer / Doubler.h
Created March 15, 2011 19:25
A light-light-light-weight Double/Mock framework for Objective-C
#import <Foundation/Foundation.h>
#import "NSObject+TestExtension.h"
@interface Doubler : NSObject {
}
+(id)named:(NSString *)name;
-(BOOL)shouldHaveReceived:(NSString *)message with:(id)parameter;
-(BOOL)shouldHaveReceived:(NSString *)message;
@mistersourcerer
mistersourcerer / NSDictionary+Persistence.h
Created March 16, 2011 19:47
NSDictionary / NSMutableDictionary plist file persistence
#import <Foundation/Foundation.h>
@interface NSDictionary(Persistence)
-(void)writeToFileInDocumentsDir:(NSString *)path atomically:(BOOL)atomically;
@end
@mistersourcerer
mistersourcerer / cliente.rb
Created October 28, 2011 18:16
stevie_restfulando
class Cliente
include ActiveModel::Validations
include ActiveModel::Serialization
def initialize(params)
#pega o hash e seta os atributos normalmente.
end
# todos meus atributos e métodos normalmente aqui
@mistersourcerer
mistersourcerer / git_rebase_shell_script.sh
Created December 27, 2011 19:30
Rebasing work branch with master, ugly as hell.
function current_branch_name {
echo $(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/")
}
function rebasing_like_a_boss {
current_branch=$(current_branch_name)
if [ $1 ] ; then to_branch=$1 ; else to_branch="master" ; fi;
git co $to_branch && git pull --rebase && git rebase $current_branch && git pull --rebase && git push && git co $current_branch && git rebase $to_branch
}
rvm use 1.9.2@rr75 --default && gem install cucumber --no-rdoc --no-ri
@mistersourcerer
mistersourcerer / Repeat.rb
Created February 27, 2012 18:15
Ruby do(repeat) until
def Repeat(&block)
_RepeatUntil = Class.new {
def repeat(&block)
block.call
@action = block
self
end
def until(&block)
until result = block.call