This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
noun_type_enable_disable = new CmdUtils.NounType( "Enable / Disable", ['enable', 'disable'] ); | |
CmdUtils.CreateCommand({ | |
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: '[email protected]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: "hello-world", | |
execute: function() { | |
var doc = Application.activeWindow.activeTab.document; | |
// find div.foo in the body of that document | |
jQuery('#content', doc.body).html('woot'); | |
displayMessage( "Hello, World!" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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+)$/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.text_without_children = function(selector) { | |
var tmp = $("<div></div>").html(this.html()), | |
collection = (typeof selector == 'undefined') ? tmp.children() : tmp.find(selector); | |
collection.remove(); | |
return tmp.text(); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 TextMate.app' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define split =='/'-'%'?_=('+'+'+'+'('):'>'>'>')||(_ | |
#define while main(_){while(((_=getchar())&&((_ | |
while | |
#define while \ | |
(@ a= | |
split | |
#ifndef __STRICT_ANSI__ | |
//,<STDIN>){while(@a&&print(chr(($a=ord(shift@a))==10?126:$a | |
#endif | |
==126? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 + 1.day | |
end | |
end |
OlderNewer