Skip to content

Instantly share code, notes, and snippets.

View kennystone's full-sized avatar

Kenny Stone kennystone

View GitHub Profile
<section>
<h3><%= t('one_master_set.title') %></h3>
<p><%= t('one_master_set.content') %></p>
</section>
var logCar = function(car) {
console.log("I am a " + car.color + ' ' + car.make);
}
logCar({ color: 'blue', make: 'BMW' });
var Car = function(make, color) {
this.color = color;
this.make = make;
this.log = function() {
var countdown = (function() {
var log = function(index) {
console.log(index);
},
iterate = function(index) {
log(index);
if(index>1) setTimeout(function() { iterate(index); }, 1000);
index--;
};
return function() { iterate(10) };
for(var currentCard in CreditCard.CARDS)
var card = currentCard;
CreditCard['is'+currentCard] = function(number){
return card.test(CreditCard.strip(number));
};
})(CreditCard.CARDS[currentCard]);
for(currentCard in CreditCard.CARDS)
var localCard = currentCard;
CreditCard['is'+currentCard] = function(number){
return localCard.test(CreditCard.strip(number));
};
})(CreditCard.CARDS[currentCard]);
foldR: function(str, acc, fun) {
var i,
len = str.length,
for(i = 0; i < len; i++) {
acc = fun(acc, str.substring(len-i-1,len-i));
}
}
isCreditCard( CC ) {
if (CC.length > 19)
require 'data_mapper'
class Post
include DataMapper::Resource
property :id, Serial
before :save, :categorize
before :update, :categorize
before :create, :categorize
@kennystone
kennystone / gist:1081237
Created July 13, 2011 20:23
reltool.config
{sys, [
{lib_dirs, ["../deps","../../"]},
{rel, "risk_scope", "1",
[
kernel, stdlib, sasl, syntax_tools, compiler, xmerl,ssl,inets,crypto,
jsx,
rabbit_common,
amqp_client,
conn_domain,
champ_domain_server,
@kennystone
kennystone / gist:1058836
Created July 1, 2011 16:03
js -> comet
api_event(start_comet, _, [ComentID]) ->
wf:comet(fun() -> up_loop() end, CometID);
api_event(send_msg, _, [CometID, Msg]) ->
wf:send(CometID, {msg, Msg}).
up_loop() ->
receive
{msg, Msg} -> error_logger:info_msg("OHAI JAVASCRIPT MSG ~p",[Msg])
end,
@kennystone
kennystone / gist:810182
Created February 3, 2011 20:57
em/sinatra example
require 'sinatra/base'
require 'eventmachine'
require 'thin'
EventMachine.run do
class Dude < Sinatra::Base
get '/' do
'oh hai'
end