Skip to content

Instantly share code, notes, and snippets.

module HasProviderSubclass
USERS = []
module ClassMethods
def type_to_class_string type
@type_to_class_string ||= Hash.new do |h, type|
h[type] = "#{self.to_s}::#{type.classify}"
end
@type_to_class_string[type]
end
@tal
tal / gist:4010504
Created November 4, 2012 05:59
Proposed table api
<%= table_for(@users) do |user| %>
<% column '', user.class.to_s.first %>
<% column 'ID', link_to(user.id, admin_user_path(user)) %>
<% column 'Name', user.name %>
<% column 'Email', user.email.andand.key %>
<% column 'Facebook' do %>
<% if user.facebook %>
<%= link_to user.facebook.key, "https://facebook.com/#{user.facebook.key}", target: "_blank" %>
<%= 'token' if user.facebook.access_token %>
<% end %>
config.action_controller.asset_host = Proc.new do |source, request=nil|
protocol = request.andand.ssl? ? "https" : "http"
protocol << "://dzb99dkvx454e.cloudfront.net"
end
local isdigest = redis.call('srem', "digest:users", ARGV[1])
local keys = redis.call('keys', "digest:"..ARGV[1]..":*")
local ret = {}
for i,key in ipairs(keys) do
local dict = {}
local keyname = key:gsub("digest:"..ARGV[1]..':','')
@tal
tal / hlall.lua
Created February 4, 2013 17:45
Returns a hash of arrays with the key being everything that `*` matches and the value being the contents of the list
local keys = redis.call('keys',KEY[1])
local ret = {}
for i,key in ipairs(keys) do
local keyname = key:sub(1,-2)
local members = redis.call('lrange', key,0 ,-1)
ret[i] = {keyname, members}
module RedisHashStore
module ClassMethods
end
module InstanceMethods
def redis_hash_store_key
@redis_hash_store_key ||= "#{self.class.redis_hash_store_key}:#{self.send(self.class.redis_hash_store_uid)}"
end
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin13.0.0
checking host system type... x86_64-apple-darwin13.0.0
checking target system type... x86_64-apple-darwin13.0.0
checking for gcc-4.2... gcc-4.2
checking for gcc... (cached) gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/tal/.rvm/src/ruby-2.0.0-p247':
configure: error: C compiler cannot create executables
See `config.log' for more details
php> class Foo {}
php> $foo = new Foo
php> $foo->bar='bar'
php> =$foo->BAR
/usr/lib/python2.4/site-packages/phpsh/phpsh.php(578) : eval()'d code:1: Undefined property: Foo::$BAR
php> =$foo->bar
(function() {
'use strict';
var once = 0;
window.BananaStand = function BananaStand() {
this.middleware = Array.prototype.slice.call(arguments);;
};
var locStorInterface = {
Array.prototype.map = function() {}
Array.prototype.select = function() {}