Skip to content

Instantly share code, notes, and snippets.

var quotes = {
'shakespeare': "All the world's a stage, And all the men and women merely players; They have their exits and their entrances, And one man in his time plays many parts, His acts being seven ages.",
'fry': "An original idea. That can't be too hard. The library must be full of them.",
'wright': "I almost had a psychic girlfriend but she left me before we met.",
'gandhi': "An eye for an eye, and soon the whole world is blind",
'mlk': "A nation that continues year after year to spend more money on military defense than on programs of social uplift is approaching spiritual doom."
}
<div class="block">
<h2>Upcoming Events</h2>
<h3>Month Name</h3>
<ul class="events">
<li>
<img alt="" src="/images/icon_cal.png">
<a href="event.url">event.title</a>
<br>
event.date
<br>
def random_pronouncable_password(size = 6)
c = %w(b c d f g h j k l m n p qu r s t v w x z ch cr fr nd ng nk nt ph pr rd sh sl sp st th tr lt)
v = %w(a e i o u y)
f, r = true, ''
(size * 2).times do
r << (f ? c[rand * c.size] : v[rand * v.size])
f = !f
end
r
end
$('body').click(function(e){
var target = e ? e.target : window.event.srcElement;
console.log("you clicked" + target);
if (target.nodeName.toLowerCase === a) {
alert ("hello");
}
})
# On the Receiving Server
rsync -arvt -e ssh --progress root@IPADDRESS:/path/to/files/ /path/to/where/you/want/to/put/files/on/recievingserver/
function (e) {
e = e || event;
var target = e.target || e.srcElement;
...
}
walkTheDOM(node, function (e) {
for (var n in e) {
if (typeof e[n] === 'function') {
e[n] = null;
}
}
});
function purgeEventHandlers(node) {
walkTheDOM(node, function (e) {
for (var n in e) {
if (typeof e[n] === 'function') {
e[n] = null;
}
}
});
}
function addEventHandler(node, type, f) {
if (node.addEventListener) {
node.addEventListener(type, f, false);
} else if (node.attachEvent) {
node.attachEvent("on" + type, f);
} else {
node["on" + type] = f;
}
}
@victortolbert
victortolbert / is_secret_additive.rb
Created January 11, 2013 17:44
“You are given a function 'secret()' that accepts a single integer parameter and returns an integer. In your favorite programming language, write a command-line program that takes one command-line argument (a number) and determines if the secret() function is additive [secret(x+y) = secret(x) + secret(y)], for all values x and y, where x and y a…
#!/usr/bin/env ruby
abort "Integer argument is required" if ARGV.empty?
limit = ARGV[0].to_i
# accepts an integer and simply returns the passed in integer
# which should be inherently additive.
def secret n
n