Skip to content

Instantly share code, notes, and snippets.

@renato-zannon
renato-zannon / module.rb
Created September 4, 2012 04:07
Subclass module + use module_eval to define methods
class AttributeAccessor < Module
def initialize(name)
@name = name
module_eval { define_accessors }
end
private
def define_accessors
ivar = "@#{@name}"
@barraponto
barraponto / git-submodule-rm.sh
Created April 25, 2012 16:36
git submodule-rm
#!/bin/bash
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}
@moraes
moraes / gist:2141121
Last active September 28, 2025 09:56
LIFO Stack and FIFO Queue in golang
package main
import (
"fmt"
)
type Node struct {
Value int
}
@coreyhaines
coreyhaines / .rspec
Last active August 15, 2024 15:13
Active Record Spec Helper - Loading just active record
--colour
-I app
@msimpson
msimpson / .Xdefaults
Created January 7, 2012 16:57
Darken
urxvt.termName: rxvt
urxvt.loginShell: true
urxvt*urlLauncher: /usr/bin/chromium
urxvt*perl-lib: /usr/lib/urxvt/perl/
urxvt*perl-ext-common: default,matcher,searchable-scrollback
urxvt*font: xft:DejaVu Sans Mono:pixelsize=10
urxvt*boldFont: xft:DejaVu Sans Mono:pixelsize=10
urxvt.scrollBar: false
urxvt.saveLines: 65535
urxvt.secondaryScroll: true
@dpiponi
dpiponi / example.cu
Created December 20, 2011 17:36
Minimal CUDA example (with helpful comments).
#include <stdio.h>
//
// Nearly minimal CUDA example.
// Compile with:
//
// nvcc -o example example.cu
//
#define N 1000
@acook
acook / ruby_dev_machine_setup.sh
Last active September 28, 2015 13:18
Simple setup script for a ruby environment on Ubuntu server.
#!/usr/bin/env/bash
# run this like: `curl https://gist.github.com/acook/1444793/raw/ruby_dev_machine_setup.sh | bash`
echo "Enter password to install packages..."
sudo apt-get update
sudo apt-get install -y build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libtool ack-grep vim-nox ctags
\curl -#L https://get.rvm.io | bash -s stable --ruby
source ~/.bashrc
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@makevoid
makevoid / Gemfile
Created September 12, 2011 02:59
Rails 3.1 Gemfile with DataMapper, RSpec, Haml, Sass, CoffeeScript and Thin (in dev)
source 'http://rubygems.org'
gem 'activesupport', :require => 'active_support'
gem 'actionpack', :require => 'action_pack'
gem 'actionmailer', :require => 'action_mailer'
gem 'railties', :require => 'rails'
gem 'mysql2'
DM_VERSION = '~> 1.2.0.rc1'
@bentruyman
bentruyman / Custom.css
Created August 17, 2011 00:30
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*