Skip to content

Instantly share code, notes, and snippets.

function f() {}
f.prototype.a = 1
// f.prototype.a is 1
x = Object.create(f)
// x.prototype.a is 1
x.prototype.a = 2
// both x.prototype.a and f.prototype.a are 2
var obj = {a: {b: 1}};
getIf(obj, 'a'); // => {b: 1}
getIf(obj, 'absentProp'); // => undefined
getIf(obj, 'a', 'b'); // => 1
getIf(obj, 'a', 'b', 'absentNestedProp'); // => undefined
@evanrmurphy
evanrmurphy / gist:4222689
Created December 6, 2012 08:13
Minimalist for Everything: Gmail inbox unread count option
[href$='#inbox'] {
visibility: hidden;
}
[href$='#inbox']:before {
content: 'Inbox';
visibility: visible;
}
@evanrmurphy
evanrmurphy / kjvarga_sitemap_generator_issue64_stacktrace.txt
Created March 12, 2012 20:20
Stack trace for kjvarga/sitemap_generator Issue #64
~/myapp$ bundle exec rake --trace sitemap:create
In ~/myapp
rake aborted!
undefined local variable or method `location' for #<#<Class:0xb050c20>:0xb050bd0>
Tasks: TOP => sitemap:create
(See full trace by running task with --trace)
evanrmurphy@inspiron1520:~/Work/rails_projects/myapp$ bundle exec rake --trace sitemap:create
** Invoke sitemap:create (first_time)
** Invoke sitemap:require_environment (first_time)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Try LavaScript</title>
<!--
Copyright 2011 Ross Angle (rocketnia). This file is released under
the Perl Foundation's Artistic License 2.0.
Not covered by the license are Underscore, jQuery, jQuery-console,
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Try LavaScript</title>
<!--
Copyright 2011 Ross Angle (rocketnia). This file is released under
the Perl Foundation's Artistic License 2.0.
Not covered by the license are Underscore, jQuery, jQuery-console,
(def foo
(prn "hello world!"))
# Trying to write a simplified let macro to learn PicoLisp
# In arc this could be expressed as:
#
# (mac mylet (var val . body)
# `((fn (,var) ,@body) ,val))
#
# I've tried to translate this into PicoLisp below, but it is
# not working.
(de mylet (@var @val . @body)
3 3 + x set!
this that the_other dofunc
4 5 + y set!
3 3 +
x
set!
this that the_other dofunc
4 5 +
@evanrmurphy
evanrmurphy / person.js
Created December 28, 2010 09:23
somewhat more readable than the compiled output
personUpdateSternness = (function() {
return ((this.laughter==0) ? this.sternness=true
: (this.laughter>5) ? this.sternness=null
: null),
this.sternness;
}),
personUpdateLaughter = (function() {
return (!this.sternness ? (this.laughter += 10)
: (--this.laughter,