Skip to content

Instantly share code, notes, and snippets.

View neocsr's full-sized avatar

Christian Sousa neocsr

  • Cupertino, CA
  • 20:40 (UTC -12:00)
View GitHub Profile
module A
def a
end
end
class B
include A
end
class C
@neocsr
neocsr / culerity.js
Created August 13, 2012 05:41 — forked from jlindsey/culerity.js
Using Cucumber/Capybara/Culerity, a step to wait until all AJAX calls are complete.
// this allows culerity to wait until all ajax requests have finished
jQuery(function($) {
var original_ajax = $.ajax;
var count_down = function(callback) {
return function() {
try {
if(callback) {
callback.apply(this, arguments);
};
} catch(e) {
@neocsr
neocsr / custom_step.rb
Created September 12, 2012 03:48 — forked from jonhoman/custom_step.rb
Cucumber VCR examples
Given /^I have a feed I want to edit$/ do
VCR.use_cassette("feed") do
@feed = Factory :feed
end
end
@neocsr
neocsr / vcr_steps.rb
Created September 12, 2012 03:50 — forked from myronmarston/vcr_steps.rb
Example of using VCR in a cucumber step definition
When /^I search for "([^"]+)" near "([^"]+)"/ do |name, location|
fill_in "Name", :with => name
fill_in "Location", :with => location
cassette_name = "searches/#{location}/#{name}"
VCR.use_cassette(cassette_name) do
click_button "Search"
end
end
@neocsr
neocsr / result.txt
Created September 27, 2012 20:38 — forked from kyanny/result.txt
RUBY_VERSION # => "1.8.7"
zero_width_space = "\xE2\x80\x8B" # => "\342\200\213"
zero_width_space # => "\342\200\213"
zero_width_space.length # => 3
white_space = "" # => ""
white_space # => ""
white_space.length # => 0
RUBY_VERSION # => "1.9.2"
zero_width_space = "\xE2\x80\x8B" # => "​"
@neocsr
neocsr / graphite.md
Created September 28, 2012 04:01 — forked from surjikal/graphite.md
Installing Graphite on OS X Lion

Follow these steps to install graphite on OS X Lion.

Prerequisites

  • Python 2.7
  • Brew
  • Git

Install dependencies

Install Cairo

@neocsr
neocsr / graphite.md
Created September 28, 2012 04:37 — forked from caged/graphite.md
Installing Graphite on OS X Lion

This is a general overview (from memory) of the steps I used to install graphite (http://graphite.wikidot.com) on OS X Lion. I think the steps are in order but YMMV. Please fork and fix if you find an error.

Install Python 2.7.2

brew install python

Check your env

$ python --version
@neocsr
neocsr / install_graphite_statsd_ubuntu_precise.sh
Created September 28, 2012 18:33 — forked from bhang/install_graphite_statsd_ubuntu_precise.sh
Install Graphite and statsd on Ubuntu 12.04 LTS (Precise Pangolin)
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
@neocsr
neocsr / heroku.rake
Created October 2, 2012 05:02 — forked from myronmarston/heroku.rake
Rake task to download a sql dump from a heroku app
namespace :heroku do
def app_name
@app_name ||= Heroku::Command::BaseWithApp.new([]).app
end
def latest_bundle(timeout = 30)
puts "Attempting to get latest bundle..."
get_bundle = lambda do
bundles = Heroku::Command.run('bundles', {})
bundles.sort { |b1, b2| b1[:created_at] <=> b2[:created_at] }
@neocsr
neocsr / xkcdify.m
Created October 9, 2012 06:12
XKCDIFY! Redraw existing Matlab axes in an XKCD style
function xkcdify(axHandle)
%XKCDIFY redraw an existing axes in an XKCD style
%
% XKCDIFY( AXES ) re-renders all childen of AXES to have a hand drawn
% XKCD style, http://xkcd.com, AXES can be a single axes or a vector of axes
%
% NOTE: Only plots of type LINE and PATCH are re-rendered. This should
% be sufficient for the majority of 2d plots such as:
% - plot
% - bar