Skip to content

Instantly share code, notes, and snippets.

require 'amazon/aws'
require 'amazon/aws/search'
include Amazon::AWS
include Amazon::AWS::Search
KEY_ID = ""
ASSOCIATES_ID = ""
def self.get_aws_ads(keywords)
is = ItemSearch.new( 'All', { 'Keywords' => keywords } )
require "rubygems"
require "term/ansicolor"
require "tempfile"
class Array
def split(length=self.length/2)
sets = Array.new
self.each_slice(length){|s| sets << s}
sets
end
alias xclip='pbcopy'
alias c='xclip'
alias cdc='pwd | c'
alias p='pbpaste'
alias cdp='cd `p`'
alias clr='clear'
-------
alias c='xclip -selection c'
# .irbrc
require 'rubygems'
begin
# load wirble
require 'wirble'
# start wirble (with color)
Wirble.init
Wirble.colorize
rescue LoadError => err
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
export PS1='\[\033[0;32m\]\h\[\033[0;36m\] \w\[\033[0;33m\]$(parse_git_branch)\[\033[00m\]: '
# Something I have wanted to write for a while,
# takes text and converts to an image, very simple.
# Erick Schmitt - July 19, 2009
module ImageText
require 'rubygems'
require 'fileutils'
require 'RMagick'
include Magick
def obtain_class
class_name = ENV['CLASS'] || ENV['class']
raise "Must specify CLASS" unless class_name
@klass = Object.const_get(class_name)
end
def obtain_attachments
name = ENV['ATTACHMENT'] || ENV['attachment']
raise "Class #{@klass.name} has no attachments specified" unless @klass.respond_to?(:attachment_definitions)
if !name.blank? && @klass.attachment_definitions.keys.include?(name)
var conditionalLoader = function (condition, execute) {
var interval = setInterval(function () {
if (condition()) {
clearInterval(interval);
execute();
}
}, 50);
};
#!/bin/bash
############################################################################
# Script to open a directory in TextMate excluding certain directories that
# tend to slow down the Find in Project... function.
#
# Place in an executable loctation with a name of your choosing.
# I use `mt'
# Original: http://www.wezm.net/technical/2009/05/exclude-directories-from-textmate-side-bar-for-faster-find-in-project/
############################################################################
copy this file to ~/.git-completion.sh
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
Add this to your .bashrc, or .profile, or whatever:
source ~/.git-completion.sh