Skip to content

Instantly share code, notes, and snippets.

View robotmay's full-sized avatar

Robert May robotmay

View GitHub Profile
@mdo
mdo / 00-intro.md
Last active June 25, 2024 18:16
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@mego22
mego22 / tmate-slave-ubuntu-1604.md
Last active December 7, 2021 23:28
Tmate-slave on Ubuntu 16.04

Install dependincies

apt-get install  git-core build-essential pkg-config libtool libevent-dev libncurses-dev zlib1g-dev automake libssh-dev cmake ruby

Install msgpack >= 1.2.0

cd /tmp
git clone https://github.com/msgpack/msgpack-c.git
./create_keys.sh
’Twas brillig, and the slithy git repos
Did gyre and gimble in the wecks:
All mimsy were the borogoves,
And the mome raths Mutex.
“Beware the legacy code, my son!
The classes that bite, the patches that catch!
Beware the Gemfile.lock, and shun
The frumious monkey patch!”
@mislav
mislav / procs-vs-lambda.md
Last active March 26, 2021 18:34
Jim Weirich on the differences between procs and lambdas in Ruby

Jim Weirich:

This is how I explain it… Ruby has Procs and Lambdas. Procs are created with Proc.new { }, lambdas are created with lambda {} and ->() {}.

In Ruby 1.8, proc {} creates lambda, and Ruby 1.9 it creates procs (don't ask).

Lambdas use method semantics when handling parameters, procs use assignment semantics when handling parameters.

This means lambdas, like methods, will raise an ArgumentError when called with fewer arguments than they were defined with. Procs will simply assign nil to variables for arguments that were not passed in.

@elvuel
elvuel / setup.md
Created October 8, 2012 06:35 — forked from leesmith/setup.md
Ruby on Rails development setup on Ubuntu 12.04 (vim, git, rbenv)

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev

@mikeric
mikeric / stapes-adapter.js
Created July 31, 2012 20:51
Stapes.js adapter for Rivets.js
rivets.configure({
adapter: {
subscribe: function(obj, keypath, callback) {
obj.on("change:" + keypath, callback);
},
unsubscribe: function(obj, keypath, callback) {
obj.off("change:" + keypath, callback);
},
@brianjlandau
brianjlandau / soft_delete.rb
Created December 14, 2011 00:32
This is a soft delete mixin for ActiveRecord 3.x. All you need to do is add a `deleted_at` column to the ActiveRecord models you mix this into.
module SoftDelete
extend ActiveSupport::Concern
included do
define_model_callbacks :soft_delete
define_model_callbacks :recover
default_scope where(:deleted_at => nil)
class_eval do
class << self
alias_method :with_deleted, :unscoped
@v1nc3ntlaw
v1nc3ntlaw / rbenv-install-system-wide.sh
Last active July 26, 2022 01:08
rbenv install ruby 1.9.3-p448 on Debian 6 Squeeze
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline5 libreadline5-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
@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:

@dimianstudio
dimianstudio / gist:874306
Created March 17, 2011 13:31
simple_form && ancestry && grouped_colection_select
.input.required
= f.label :rate_plan_id
= f.grouped_collection_select :rate_plan_id, RatePlan.roots, :children, :name, :id, :name, {:include_blank => true}