Skip to content

Instantly share code, notes, and snippets.

View jacksonwillis's full-sized avatar

Jackson Willis jacksonwillis

  • Madison, Wisconsin
View GitHub Profile
@jacksonwillis
jacksonwillis / hello.js
Created February 18, 2012 18:09
VALID_JS
(function ()
{
return (function ()
{
return eval("(function ()\
{\
return (function ()
{\
alert('Hello, world!');\
})();\
PROMPT="[%B%{$fg[green]%}%n@%m %{$fg[blue]%}%~%b] %# "
RPROMPT="[%B%D / %*%b]"
@jacksonwillis
jacksonwillis / gist:2046015
Created March 15, 2012 18:54
Jarl Expectations
(function hello 1 n
(/puts 'Hello, ' n '!'))
(hello 'Hope')
(hello 'world')
(/require 'yaml')
(set name-of-god 'Athena')
@jacksonwillis
jacksonwillis / s.rb
Created April 10, 2012 21:33
Sentences as Ruby code
class S; def initialize *w; @s=w; end; def method_missing *w;@s<<w;self;end;def
to_ary;[@s.map{ |e| e=~/[\,\.\:\-\(\)\/\'\"]/?[e]:[" ",e] }.join.strip];end;end
def Object.const_missing(c);S.new c;end; ###### https://gist.github.com/2354740
puts This.is.a.sentence.represented.by.a.Ruby.expression(",").try.it.out! #####
Number.prototype.superfactorial = function() {
var a, e, d, b, c;
d = 1;
for(a = b = 2;2 <= this ? b <= this : b >= this;a = 2 <= this ? ++b : --b) {
for(e = c = 2;2 <= a ? c <= a : c >= a;e = 2 <= a ? ++c : --c) {
d *= e
}
}
return d
};
/* SEMICOLON2.js
Copyright 2012 Jack Willis */
(function () { return ;;; }).call(this);
@jacksonwillis
jacksonwillis / range.js
Created April 28, 2012 00:06
Recursive Javascript range function
/* recursive version
*/
var M = function (f) { return f(f); } // Mockingbird function
range = M(function (f) {
return function (min, max) {
return min === max ? [min] : [min].concat(f(f)(min + 1, max));
}
});
@jacksonwillis
jacksonwillis / vector.coffee
Created May 11, 2012 18:33
CoffeeScript Vector Math
Number::toRadians = -> (@ * Math.PI) / 180
Number::toDegrees = -> (@ * 180) / Math.PI
Array::product = -> @reduce (a, e) -> a * e
Array::sum = -> @reduce (a, e) -> a + e
Array::zip = (args...) -> ((args...) ->
longest = args.reduce ((a, b) -> (if a.length > b.length then a else b)), []
longest.map (_, i) -> args.map (array) -> array[i])(@, args...)
@jacksonwillis
jacksonwillis / timing.coffee
Created May 18, 2012 19:07
Coffeescript Idiomatic Timing Events
inAbout = (n) -> new ->
@milliseconds = (f) -> setTimeout f, n
@seconds = (f) -> setTimeout f, n * 1000
every = (n) -> new ->
@milliseconds = (f) -> setInterval f, n
@seconds = (f) -> setInterval f, n * 1000
console.log "starting!"
inAbout(3).seconds ->
@jacksonwillis
jacksonwillis / lol.html
Created May 31, 2012 15:56
click here 4 fun!! (siezure warning)
<a href="data:text/html,plain;%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3Ctitle%3EOMG!%3C%2Ftitle%3E%3Cscript%3Ewindow.onload%3Dfunction()%7BsetInterval(function()%7Bvar%20a%3Ddocument.body.style%3Ba.background%3D%22%23%22%2Bc(0%2C16777215).toString(16)%3Ba.fontSize%3Dc(10%2C100)%2B%22px%22%3Ba.padding%3Dc(10%2C125)%2B%22px%22%3Bvar%20b%3Dc(5%2C10)%3Bfor(var%20d%3D%22A%22%2Ca%3D0%3Ba%3Cb%3B%2B%2Ba)d%2B%3D%22A%22%3Bdocument.body.innerHTML%3Dd%7D%2C50)%7D%3Bfunction%20c(a%2Cb)%7Breturn%20a%2BMath.floor(Math.random()*(b-a))%7D%3B%3C%2Fscript%3E%3Cbody%20style%3Dcolor%3Awhite%3E">click here 4 fun!!</a>