Skip to content

Instantly share code, notes, and snippets.

Amiel Martin amiel

Block or report user

Report or block amiel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:54772
noun_type_enable_disable = new CmdUtils.NounType( "Enable / Disable", ['enable', 'disable'] );
name: "javascript",
synonyms: ['js'],
description: 'Enable or disable javascript for your browser. You will have to refresh the page for changes to take effect.',
author: {
name: 'Amiel Martin',
email: ''
View using jQuery in a ubiquity command
name: "hello-world",
execute: function() {
var doc = Application.activeWindow.activeTab.document;
// find in the body of that document
jQuery('#content', doc.body).html('woot');
displayMessage( "Hello, World!" );
amiel / gist:69934
Created Feb 25, 2009
give it a value in seconds, and it will return a sentence
View gist:69934
def length_of_time_in_words(seconds)
seconds = seconds.to_i
%w[ year month week day hour minute second ].collect do |unit|
unit_in_seconds = 1.send(unit).to_i
n = seconds / unit_in_seconds
seconds -= n * unit_in_seconds
View gist:97387
module IncrementifyString
# Helps create a user friendly unique string
# For example, calling incrementify! repeatedly starting with
# 'string' would yield:
# 'string' => 'string1' => 'string2' => 'string3' ... 'string9' => 'string10' => 'string11' ... etc
def incrementify!
if match(/[0-8]$/)
succ! # this is faster than regex parse and to_i + 1 to_s
elsif ends_with?('9')
m = match(/(\d+)$/)
View .irbrc
script_console_running = ENV.include?('RAILS_ENV') && IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
rails_running = ENV.include?('RAILS_ENV') && !(IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
irb_standalone_running = !script_console_running && !rails_running
if script_console_running
require 'logger'
View gist:110219
$.fn.text_without_children = function(selector) {
var tmp = $("<div></div>").html(this.html()),
collection = (typeof selector == 'undefined') ? tmp.children() : tmp.find(selector);
return tmp.text();
alias gb='for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cblue%cr%Creset" $k|head -n 1`\\t$k;done'
# Output
# ------
# ~/Development/github(master)$ gb
# 4 weeks ago config-gem
# 9 days ago dropdown
# 5 weeks ago faucet
# 3 weeks ago health
View .bashrc
export PATH="/usr/local/texlive/2008/bin/universal-darwin/:/opt/local/bin:/opt/local/sbin:$PATH:~/bin:/usr/local/mysql-5.0.67-osx10.5-x86/bin/:/usr/local/bin"
export MANPATH=/opt/local/share/man:$MANPATH
export LC_CTYPE=en_US.UTF-8
alias irb='irb --readline -r irb/completion'
# alias mate='open -a'
View gist:163455
#define split =='/'-'%'?_=('+'+'+'+'('):'>'>'>')||(_
#define while main(_){while(((_=getchar())&&((_
#define while \
(@ a=
#ifndef __STRICT_ANSI__
View add_pagination_by_day_to_will_paginate.rb
require_dependency 'will_paginate'
require_dependency 'will_paginate/finder'
unless Time.instance_methods.include? 'at_end_of_day'
Time.class_eval do
def at_end_of_day
self.at_beginning_of_day +
You can’t perform that action at this time.