Skip to content

Instantly share code, notes, and snippets.

View donaldpiret's full-sized avatar
:shipit:
Shippin' stuff

Donald Piret donaldpiret

:shipit:
Shippin' stuff
View GitHub Profile
// The `quickEach` method will pass a non-unique jQuery instance
// to the callback meaning that there will be no need to instantiate
// a fresh jQuery instance on each iteration. Most of the slow-down
// inherent in jQuery's native iterator method (`each`) is the constant
// need to have access to jQuery's methods, and so most developers
// see constructing multiple instances as no issue... E.g.
// $(...).each(function(){ $(this)... $(this)... $(this)... });
// A better approach would be `quickEach`.
jQuery.fn.quickEach = (function(){
@queso
queso / config.ru
Created February 6, 2011 03:30
An example config.ru file for dynamically adding CIJoe projects, just place this at the root of your folder structure
# Required so that we can set path correctly for Config, which
# is loaded statically due to a bug in cijoe
require 'cijoe'
# setup middleware
use Rack::CommonLogger
# Assume all subfolders under config.ru are git repos and collect them to spin up multiple joes
projects = Dir.glob("*/")
@skorianez
skorianez / gist:1308103
Created October 24, 2011 00:06
JCrop + Carrierwave
# https://github.com/gzigzigzeo/carrierwave-meta
# Integrating CarrierWave with JCrop
# Let implement the behavior like at this demo: deepliquid.com/projects/Jcrop/demos.php?demo=thumbnail
# The uploader:
class CropUploader < SobakaUploader
include CarrierWave::Meta
# Crop source is a source image converted from original which could be bigger than source area (left image in the example).
version :crop_source do
@huynguyen
huynguyen / gist:1329273
Created October 31, 2011 22:42
ruby-1.9.3-p0 ruby-debug and rvm
#Need the latest version so it knows where to get ruby-1.9.3
rvm get head
curl -O https://github.com/ruby/ruby/pull/56.diff
rvm install ruby-1.9.3-p0 --patch 56.diff
cd ~/.rvm/src/ruby-1.9.3-p0
# Need to recompile because rvm doesn't force autoconf?
@dx7
dx7 / gist:1333785
Created November 2, 2011 14:33
Installing ruby-debug with ruby-1.9.3-p0
### UPDATE: ruby-debuy19 is no longer maintained, use https://github.com/cldwalker/debugger
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
@zoras
zoras / fixes.md
Created November 7, 2011 06:34 — forked from thbar/fixes.md
Getting rid of nokogiri segfaults

This readme is a mixture of everything I read on SO+nokogiri wiki, which ultimately worked out for me.

Here are the steps which worked for me to get rid of segfaults with Nokogiri 1.4.4, on both Lion and Snow Leopard, with Ruby 1.8.7 (patchlevel 334 and +).

First diagnose which version of libxml2 you're using:

bundle exec nokogiri -v

If you have 2.7.3 listed somewhere, you're in bad waters (known to segfault). Install this:

@joakimk
joakimk / graphite.rb
Created January 25, 2012 20:14
Graphite client for ruby with specs
require 'socket'
class Graphite
def initialize(host)
@host = host
end
def socket
return @socket if @socket && !@socket.closed?
@socket = TCPSocket.new(@host, 2003)
@dougo-chris
dougo-chris / everything
Created April 14, 2012 04:47
jasmine & jenkins
group :development, :test do
gem 'jasmine', '1.2.0.rc2', :git => 'https://github.com/pivotal/jasmine-gem.git', :require => false
# gem 'jasmine'
gem 'headless', :require => false
bundle install
bundle exec jasmine init
rm lib/tasks/jasmine.rake
@jrafanie
jrafanie / gist:3011499
Created June 28, 2012 13:49
ActiveRecord::Base doesn't serialize instance variables
~/Code/playground/rails-3-2-stable $ cat app/models/person.rb
class Person
attr_accessor :abc
end
~/Code/playground/rails-3-2-stable $ cat app/models/story.rb
class Story < ActiveRecord::Base
attr_accessor :abc
end
@jabley
jabley / convert2csv.sh
Created September 13, 2012 11:05
Scripts to help with converting an Oracle .dmp to CSV
#!/bin/sh
# script to automate the load and export to CSV of an oracle dump
# This script assumes:
# * you have the vagrant published key available locally in your .ssh directory
# * You have the Oracle VirtualBox image running locally
# ** ssh port-forwarding is configured for host port 2022 -> guess port 22.
set -e