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
namespace :git do | |
desc "hack" | |
task :hack, [:target_branch] do |t, args| | |
require 'git' | |
# assume current working directory | |
g = Git.open('.') | |
args.with_defaults(:target_branch => "master") | |
current_branch = g.current_branch | |
`git checkout #{args.target_branch}` |
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
namespace :fogbugz do | |
# Usage: | |
# | |
# sake fogbugz:branch[source_branch, "My Project"] | |
# | |
# | |
desc "Setup a branch for each case assigned to me." | |
task :branch, [:target_branch, :project] do |t, args| |
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
# | |
# NOTE: set pem_file when loading | |
module ActiveMerchant #:nodoc: | |
module Billing #:nodoc: | |
class PaypalRecurringGateway < Gateway | |
include PaypalCommonAPI | |
self.supported_cardtypes = [:visa, :master, :american_express, :discover] | |
self.supported_countries = ['US'] | |
self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_wp-pro-overview-outside' |
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 self.transport_via_smtp(tmail, options={}) | |
o = options[:smtp] || {} | |
smtp = Net::SMTP.new(o[:host], o[:port]) | |
smtp.start(o[:domain], o[:user], o[:password], o[:auth]) | |
smtp.send_message tmail.to_s, tmail.from, tmail.to | |
smtp.finish | |
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
require 'net/imap' | |
class Net::IMAP | |
def idle | |
cmd = "IDLE" | |
synchronize do | |
tag = generate_tag | |
put_string(tag + " " + cmd) | |
put_string(CRLF) | |
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
def teh_decorator(func): | |
def wrapped(*args, **kwargs): | |
if len(args) > 0: | |
func.new_thing = args[0] | |
return func(**kwargs) | |
return wrapped | |
@teh_decorator | |
def testmeyo(): | |
pass |
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
; python/django | |
(font-lock-add-keywords | |
'python-mode | |
'(("\\<\\(models.\\)\\(Admin\\|AutoField\\|BooleanField\\|CharField\\|CommaSeparatedIntegerField\\|DateField\\|DateTimeField\\|DecimalField\\|EmailField\\|FileField\\|FilePathField\\|FloatField\\|ForeignKey\\|ImageField\\|IntegerField\\|IPAddressField\\|ManyToManyField\\|NullBooleanField\\|OneToOneField\\|PhoneNumberField\\|PositiveIntegerField\\|PositiveSmallIntegerField\\|SlugField\\|SmallIntegerField\\|TextField\\|TimeField\\|URLField\\|USStateField\\|XMLField\\)\\>" (1 font-lock-keyword-face) (2 font-lock-keyword-face)))) |
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 linebreaksul(value): | |
""" | |
Converts a series of newlines into list items enclosed in an unordered list. | |
""" | |
unordered_list = "<ul>" | |
# split value into individual elements separated by newline | |
list_items = value.split('\n') | |
for li in list_items: | |
unordered_list += "<li>%s</li>" % li |
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
(font-lock-add-keywords | |
'ruby-mode | |
'(("\\([-,\\+\\*/%&|\\^~=>]\\)" . font-lock-keyword-face))) |
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 'spec' | |
class Something | |
def initialize | |
do_something | |
end | |
def do_something | |
raise NotImplementedError.new("Not Yet Implemented") | |
end |
OlderNewer