Skip to content

Instantly share code, notes, and snippets.

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
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
@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}
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]..':','')
config.action_controller.asset_host = Proc.new do |source, request=nil|
protocol = request.andand.ssl? ? "https" : "http"
protocol << "://dzb99dkvx454e.cloudfront.net"
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 %>
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
module RequestPagination
def self.included(klass)
klass.scope :paginate_from, ->(request,limit=nil) do
dset = self
if id = request.headers['X-delight-lt-id']
dset = dset.where(:_id.lt => id)
end
if limit = request.headers['X-delight-item-limit']||limit
dset = dset.limit(limit)
class Contact < Person
end
module Helpers
def self.constantize(camel_cased_word)
names = camel_cased_word.split('::')
names.shift if names.empty? || names.first.empty?
constant = Object
names.each do |name|
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
end
constant