Skip to content

Instantly share code, notes, and snippets.

View amiel's full-sized avatar

Amiel Martin amiel

View GitHub Profile
@amiel
amiel / Use of the ! operator
Created April 28, 2011 21:18
not_operator.rb
# Some values, they are themselves
true # => true
false # => false
"value" # => "value"
0 # => 0
nil # => nil
#! /usr/bin/ruby
# data set:
# id | name | score | postal | color
# 1 | john | 14 | 12345 | blue
# 2 | jane | 10 | 12345 | blue
# 3 | jeff | 6 | 12345 | green
# define a simple class for holding the dataset
@amiel
amiel / GetBundles.sh
Created April 14, 2011 20:51
How to get GetBundles to work with rvm
#!/bin/bash
if [ `echo -n "$DIALOG" | tail -c 1` != "2" ]; then
CHECK=$("$DIALOG" -l | egrep -c 'TextMate — GetBundles')
else
CHECK=$("$DIALOG" nib --list | egrep -c 'TextMate — GetBundles')
fi
[[ ! -d ~/Library/Logs ]] && mkdir -p ~/Library/Logs
rm -f ~/Library/Logs/TextMateGetBundles.log
# ~/.rvm/gemsets/global.gems
rake
bundler
autotest-fsevent
autotest-growl
@amiel
amiel / gist:853544
Created March 3, 2011 20:57
inspect the rack env without seeing too much
env.each do |key, value|
Rails.logger.error("#{key.inspect} => #{value.inspect}"[0..150])
end
@amiel
amiel / caveatPatchor.js
Created February 22, 2011 01:31 — forked from protocool/caveatPatchor.js
fork of caveatPatch.js for propane that supports gravatars
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
@amiel
amiel / validation.js
Created November 29, 2010 22:28
very simple custom form validator
var validate = (function() {
var c = { log: function() {} };
// var c = console;
var f = function() {
$(this).each(function() {
var t = $(this);
@amiel
amiel / .gitignore
Created November 15, 2010 18:38 — forked from redoPop/.gitignore
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
def indefinitize(string)
vowels = "aeiou".split(//)
vowels.include?(string.first.downcase) ? "an #{string}" : "a #{string}"
end
<%= highlight(t(:'.confirm', :resource => resource, :default => :'delete.confirm'), resource.to_s) %>
<%= semantic_form_for resource, :html => { :method => :delete } do |form| %>
<%= form.buttons do %>
<%= form.commit_button :delete %>
<% end %>
<% end %>