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 Basecamp | |
class Message | |
attr_accessor :notify | |
def to_xml(arg={}) | |
# Little heavy handed but...it does the trick. | |
doc = Nokogiri::XML(super(arg)) | |
# This doesn't create a "request" element by default, so lets | |
# create one. |
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 Basecamp | |
class Project | |
def people | |
get(:people).map { |h| Basecamp::Person.new(h) } | |
end | |
end | |
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
module Basecamp | |
class Message | |
attr_accessor :notify | |
def to_xml(arg={}) | |
# Little heavy handed but...it does the trick. | |
doc = Nokogiri::XML(super(arg)) | |
# This doesn't create a "request" element by default, so lets | |
# create one. |
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 Sprockets::Helpers::RailsHelper | |
require File.join(Rails.root, "app", "helpers", "assets_helper.rb") | |
include AssetsHelper | |
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
$(function() { | |
$('body').empty(); | |
document.title = "REDDIT IS A WASTE OF TIME"; | |
}); |
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
1.9.3p125 :009 > "don't feel".match(/(?<word>feel|don't feel)/) | |
=> #<MatchData "don't feel" word:"don't feel"> |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <time.h> | |
void flip(char * str, int len) { | |
int byte, bit, bias; | |
char mask; | |
/* mmm, seeeds */ |
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 'uri/http' | |
# Blatently stolen from http://www.simonecarletti.com/blog/2009/04/validating-the-format-of-an-url-with-rails/ | |
# | |
# Validates whether the value of the specified attribute matches the format of an URL, | |
# as defined by RFC 2396. See URI#parse for more information on URI decompositon and parsing. | |
# | |
# This method doesn't validate the existence of the domain, nor it validates the domain itself. | |
# | |
# Allowed values include http://foo.bar, http://www.foo.bar and even http://foo. |
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
(function() { | |
var methodMap = { | |
'create': 'POST', | |
'update': 'PUT', | |
'delete': 'DELETE', | |
'read' : 'GET' | |
}; | |
var getUrl = function(object) { | |
if (!(object && object.url)) return null; |
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 'open3' | |
namespace :redis do | |
task :cli do | |
redis_config = File.expand_path('../../../config/redis.yml', __FILE__) | |
config_data = YAML.load_file(redis_config) | |
uri = URI.parse(config_data[ENV['RAILS_ENV'] || 'development']) | |
cli = File.expand_path('/path/to/redis-cli', __FILE__) |
OlderNewer