This file contains hidden or 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
| sys = require('sys') | |
| for(var n in ["foo", "bar"]) { | |
| sys.puts(n) | |
| } |
This file contains hidden or 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 'lib/string_util.rb' | |
| require 'singleton' | |
| require 'rubygems' | |
| require 'active_support/core_ext/class/attribute_accessors' | |
| class Tokenizer | |
| include Singleton |
This file contains hidden or 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 takes_an_optional_block(&block) | |
| block_given_for_optional = block_given? | |
| stash_block { | |
| block_given_for_stash = block_given? | |
| puts "block_given_for_optional: #{block_given_for_optional}" | |
| puts "block_given_for_stash: #{block_given_for_stash}" | |
| } | |
| end | |
| def stash_block(&block) |
This file contains hidden or 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
| <?php | |
| $mailer = new MadMailer('YOURUSERNAME', 'XXXXXXXX'); | |
| $params = array( | |
| 'promotion_name' => 'My Awesome Promotion', | |
| 'subject' => 'You Gotta Read This', | |
| 'from' => 'noreply@example.com', | |
| 'username' => 'YOURUSERNAME', | |
| 'api_key' => 'XXXXXXXX', | |
| 'list_name' => 'VIPs', | |
| 'raw_html' => 'foo [[unsubscribe]] [[tracking_beacon]]' |
This file contains hidden or 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
| gemcutter => redis downloads spec | |
| ================================= | |
| keys | |
| ---- | |
| downloads => global counter for all gem downloads | |
| downloads:today => sorted set for downloads from today | |
| downloads:rubygem:rails => counter for all rails downloads | |
| downloads:version:rails-2.3.5 => counter for all rails 2.3.5 downloads |
This file contains hidden or 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 'webrick' | |
| require 'webrick/httpproxy' | |
| require 'fileutils' | |
| require 'md5' | |
| ### | |
| # FakeWebRecorder is an HTTP Proxy that records sessions as calls to FakeWeb. | |
| # The code that FakeWebRecorder generates should be suitable for testing | |
| # interaction with a particular website. | |
| # |
This file contains hidden or 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
| # mechanize just enough of campfire to get what i need | |
| require 'mechanize' | |
| class Campfireanize | |
| def initialize(subdomain) | |
| @subdomain = subdomain | |
| @client = Mechanize.new | |
| @logged_in = false | |
| end |
This file contains hidden or 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
| using System.Net; | |
| using System.IO; | |
| using System.Collections; | |
| using System.Collections.Specialized; | |
| using System; | |
| using System.Web; | |
| using System.Security.Cryptography.X509Certificates; | |
| public class Program : ICertificatePolicy { | |
| public bool CheckValidationResult (ServicePoint sp, X509Certificate certificate, WebRequest request, int error) { |
This file contains hidden or 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
| # not sure if i like this or not | |
| # but it was fun to write! | |
| # :Foo => Foo, :Foo, :Bar => Foo::Bar, etc | |
| def with_foo_like_class(*args) | |
| klass = if args.size == 1 | |
| klass_obj = Class.new | |
| Object.const_set(args[0], klass_obj) | |
| else | |
| klass_sym = args.pop |
This file contains hidden or 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 :deploy do | |
| desc "What will be deployed on the next release" | |
| task :what do | |
| puts run_locally "git log --color #{current_revision}..#{real_revision}" | |
| end | |
| end |