Skip to content

Instantly share code, notes, and snippets.

View eval's full-sized avatar
💭
ƛ

Gert Goet eval

💭
ƛ
View GitHub Profile
@eval
eval / Rakefile
Created November 5, 2010 20:56
Rakefile
require 'rubygems'
require 'rake/remote_task'
desc 'rsyncs ./ => remote:/tmp'
remote_task :should_work do
rsync('./', '/tmp')
end
desc 'rsyncs ./ => remote:/tmp'
remote_task :should_fail do
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
@eval
eval / gist:946103
Created April 28, 2011 09:49
iterations
<% ['item 1', 'item 2'].each do |item| %>
<li><%= item %></li>
<% end %>
<% 3.times do |ix| %>
<li><%= ix %></li>
<% end %>
YELLOW='\[\e[1;33m\]'
BLUE='\[\e[1;36m\]'
RED='\[\e[1;31m\]'
WHITE='\[\e[1;37m\]'
NC='\[\033[00m\]' #'\e[0m' # No Color
function __tc_git_ps1 {
if [[ $(git rev-parse --show-cdup) == "" ]]; then
echo "${YELLOW}\$(__git_ps1 '(%s)')${NC}"
else
@eval
eval / .gitconfig
Created November 17, 2011 19:58
her name was lola
lol = log --graph --oneline --decorate
lola = log --graph --oneline --decorate --all
@eval
eval / sudo_attr_accessibility.gemspec
Created December 7, 2011 18:12
make all attributes accessible to some roles
Gem::Specification.new do |s|
s.name = "sudo_attr_accessibility"
s.version = "0.2.0"
s.summary = "Make all attributes of an AR-model accessible to some roles"
s.files = ["sudo_attr_accessibility.rb"]
s.homepage = "https://gist.github.com/1443911"
s.license = "MIT"
s.author = "Gert Goet"
s.email = "[email protected]"
s.require_paths = ['.']
@eval
eval / update
Created February 17, 2012 12:48
#! /usr/bin/env ruby
$VERBOSE=true
UNACCEPTABLE_REFNAME = /refs\/heads\/\d/
refname, oldrev, newrev = ARGV[0...3]
if oldrev[/^0{40}/] # new branch received
if refname[UNACCEPTABLE_REFNAME]
raise "Names of branches can't be of the form '#{UNACCEPTABLE_REFNAME}'"
end
## keybindings
unbind C-b
unbind C-a
unbind %
unbind ,
unbind .
unbind n
unbind p
unbind [
unbind '"'
# Source: https://gist.github.com/neerajdotname/5187092
#gem 'activerecord', '4.0.0.rc2'
gem 'activerecord', '3.2.13'
require 'active_record'
require "minitest/autorun"
require 'minitest/pride'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
# Usage:
# $ rails new blog -m https://gist.githubusercontent.com/eval/9410525/raw/template.rb
annotate_version = ask("What annotate version should I bundle? [2.6.2]")
gem 'annotate', annotate_version.presence || '2.6.2'
generate(:model, "person", "name:string")
inject_into_class 'app/models/person.rb', 'Person', " A = 1\n"
rake "db:migrate"