-
-
Save Alexei-B/aee3708a7d8280b33ed2 to your computer and use it in GitHub Desktop.
Revisions
-
Alexei Barnes revised this gist
Jan 9, 2016 . 4 changed files with 5 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Game of Life - 140byt.es An implementation of Conway's [Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) in only 90 bytes of JavaScript. See the demo: http://output.jsbin.com/zebuxi This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ b, // array to fill with new state c, // width of stage d // placeholder )=> // No {} braces are nessessary due to single statement. a.map( // Map this function over the whole old state. ( e, // placeholder @@ -27,5 +27,4 @@ )*c - c // and scale to width. ] } ) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ (a,b,c,d)=>a.map((e,f)=>{for(d=9,e=0;d--;b[f]=e==3|e==4&a[f])e+=~~a[f+d%3-1+~~(d/3)*c-c]}) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ <div id="stage"></div> <script> var game = (a,b,c,d)=>a.map((e,f)=>{for(d=9,e=0;d--;b[f]=e==3|e==4&a[f])e+=~~a[f+d%3-1+~~(d/3)*c-c]}); var width = 32; var height = 32; -
Alexei Barnes revised this gist
Aug 12, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,8 +17,8 @@ Usage Author ------ * Originally Created by Martin Kleppe ([@aemkei](http://twitter.com/aemkei)) at [Ubilabs](http://ubilabs.net/). * New Version Created by Alexei Barnes ([@Alexei_Barnes](https://twitter.com/Alexei_Barnes)) at [AlexeiBarnes.com](http://alexeibarnes.com). For more information -------------------- -
Alexei Barnes revised this gist
Aug 12, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Game of Life - 140byt.es An implementation of Conway's [Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) in only 92 bytes of JavaScript. See the demo: http://output.jsbin.com/zebuxi -
Alexei Barnes revised this gist
Aug 12, 2015 . 6 changed files with 83 additions and 66 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2015 Alexei Barnes <http://alexeibarnes.com> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,23 +2,23 @@ An implementation of Conway's [Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) in less than 140 bytes of JavaScript. See the demo: http://output.jsbin.com/zebuxi Usage ----- life ( input, // input array target, // target array width // width of stage ) Author ------ Originally Created by Martin Kleppe ([@aemkei](http://twitter.com/aemkei)) at [Ubilabs](http://ubilabs.net/). New Version Created by Alexei Barnes ([@Alexei_Barnes](https://twitter.com/Alexei_Barnes)) at [AlexeiBarnes.com](http://alexeibarnes.com). For more information -------------------- This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,31 @@ ( // Using ECMA6 arrow functions. IE, Safari & Opera probably won't work. a, // array of old state b, // array to fill with new state c, // width of stage d // placeholder )=>{ a.map( // Map this function over the whole old state. ( e, // placeholder f // linear index of cell )=>{ for( d = 9, // Start our neighborhood walk at 9. e = 0; // Start sum of neighbors at 0. d--; // Walk backwards until and including 0. b[f] = // Set cell after loop execution (only the last loop matters). e == 3 | // The sum includes self so the rules change a bit, any rusult of 3 or, e == 4 & // a result of 4 and, a[f] // self is true results in an alive cell, otherwise dead. ) e += // each loop accumulate to sum ~~a[ // Index old state and return 0 if undefined. f + // Index plus, d%3 - 1 + // convert linear walk value to horizontal component plus, ~~( // round down, d/3 // walk converted to vertical component, )*c - c // and scale to width. ] } ) } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ (a,b,c,d)=>{a.map((e,f)=>{for(d=9,e=0;d--;b[f]=e==3|e==4&a[f])e+=~~a[f+d%3-1+~~(d/3)*c-c]})} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ { "name": "gameOfLife", "description": "Even Smaller ECMA6 Implementation of Conway's Game of Live.", "keywords": [ "ecma6", "game", "life", "cellular", This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ <style type="text/css" media="screen"> #stage { display: inline-block; line-height:12px; } @@ -24,41 +25,50 @@ <body> <div id="stage"></div> <script> var game = (a,b,c,d)=>{a.map((e,f)=>{for(d=9,e=0;d--;b[f]=e==3|e==4&a[f])e+=~~a[f+d%3-1+~~(d/3)*c-c]})}; var width = 32; var height = 32; var fields = [new Array(width * height), new Array(width * height)]; var elems = []; var target = 0; var stage; function init() { stage = document.getElementById("stage"); for (var y = 0; y < height; ++y) { for (var x = 0; x < width; ++x) { elems[elems.length] = document.createElement("div"); stage.appendChild(elems[elems.length - 1]); } stage.appendChild(document.createElement("br")); } fields[0].fill(0); fields[1].fill(0); setInterval(run, 50); document.addEventListener('mousemove', brush, true); } function run() { for (var i = 0; i < width * height; ++i) elems[i].className = fields[target][i] ? "alive" : ""; game(fields[target], fields[1 - target], width); target = 1 - target; } function brush(e) { var rect = stage.getBoundingClientRect(); var x = Math.floor((e.clientX - rect.left) / (rect.width / width)); var y = Math.floor((e.clientY - rect.top) / (rect.height / height)); if (x >= 0 && y >= 0 && x < width && y < height) fields[target][x + y * width] = 1; } init(); </script> </body> -
aemkei revised this gist
Feb 14, 2012 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ # Game of Life - 140byt.es An implementation of Conway's [Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) in less than 140 bytes of JavaScript. -
aemkei revised this gist
Dec 1, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Game of Life - 140byt.es An implementation of Conway's [Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) in less than 140 bytes of JavaScript. See the demo: http://jsfiddle.net/aemkei/wdRcc/show/ Usage ----- -
aemkei revised this gist
Oct 4, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Game of Life - 140byt.es An implementation of Conway's [Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) in less than 140 bytes of JavaScript. See the example: [http://www.ubilabs.net/projects/game-of-life](http://www.ubilabs.net/projects/game-of-life) Usage ----- -
aemkei revised this gist
Aug 15, 2011 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,16 @@ life = function( input, // input array size, // square stage size (width and height) output, i, neighbours // placeholders ){ // cycle through cells for ( output = [i = size*size]; i--; output[i] = // alive if it has 3 neighbours neighbours == 3 || // stay alive if cell has 2 neighbours (input[i] && neighbours == 2) ) { neighbours = -
aemkei revised this gist
Aug 15, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ life = function( input, // input array size, // size (width and height) of stage output, i, neighbours // placeholders ){ // cycle through cells for ( -
aemkei revised this gist
Aug 15, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ life = function( input, // input array size, // size (width and height) of stage output, i, neighbourspush // placeholders ){ // cycle through cells for ( output=[i=size*size]; i--; output[i] = // live if it has 3 neighbours -
aemkei revised this gist
Aug 15, 2011 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ life = function( input, // input array size, // size (width and height) of stage output, i, neighbours, length // placeholders ){ // cycle through cells for ( output=[length=i=size*size]; i--; output[i] = // live if it has 3 neighbours -
aemkei revised this gist
Aug 15, 2011 . 3 changed files with 15 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,23 @@ live = function( input, // input array size, // size (width and height) of stage output, i, neighbours // placeholders ){ // cycle through cells for ( output=[i=size*size]; i--; output[i] = // live if it has 3 neighbours neighbours == 3 || // stay alive if it has 2 neighbours (input[i] && neighbours == 2) ) { neighbours = // count neighbours input[i-size-1] + input[i-size] + input[i-size+1] + input[i -1] + input[i +1] + input[i+size-1] + input[i+size] + input[i+size+1]; } return output; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ function(a,b,c,d,e){for(c=[d=b*b];d--;c[d]=e==3||a[d]&&e==2)e=a[d-b-1]+a[d-b]+a[d-b+1]+a[d-1]+a[d+1]+a[d+b-1]+a[d+b]+a[d+b+1];return c} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,9 +25,11 @@ <div id="stage"></div> <a href="https://gist.github.com/1134658">Source</a> <script src="annotated.js" type="text/javascript" charset="utf-8"></script> <script> var array = [], elems = {}, elem, stage = document.getElementById("stage"), -
aemkei revised this gist
Aug 14, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ function( neighbours = // count neighbours input[i-size-1] + input[i-size] + input[i-size+1] + input[i -1] + input[i +1] + input[i+size-1] + input[i+size] + input[i+size+1]; output[i] = -
aemkei revised this gist
Aug 14, 2011 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,6 +23,8 @@ </head> <body> <div id="stage"></div> <a href="https://gist.github.com/1134658">Source</a> <script> var life = function(a,b,c,d,e){for(d=c=[];d++<b*b;)e=a[d-b-1]+a[d-b]+a[d-b+1]+a[d-1]+a[d+1]+a[d+b-1]+a[d+b]+a[d+b+1],c[d]=e==3||a[d]&&e==2;return c}, array = [], -
aemkei revised this gist
Aug 14, 2011 . 2 changed files with 8 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,8 +24,4 @@ Created by Martin Kleppe ([@aemkei](http://twitter.com/aemkei)) at [Ubilabs](htt For more information -------------------- See the [140byt.es](http://140byt.es) site for a showcase of entries (built itself using 140-byte entries!), and follow [@140bytes](http://twitter.com/140bytes) on Twitter. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ { "name": "gameOfLife", "description": "Implementation of Conway's Game of Live.", "keywords": [ "conway", "game", "life", "cellular", "automaton" ] } -
aemkei revised this gist
Aug 14, 2011 . 4 changed files with 66 additions and 93 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,25 @@ Game of Life - 140byt.es ======================== An implementation of Conway's [Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) in less than 140 bytes of JavaScript. See the example: [ubilabs.net/projects/game-of-live](http://www.ubilabs.net/projects/game-of-live) Usage ----- life ( input, // input array size // size (width and height) of stage ) // returns the modificated input string Author ------ Created by Martin Kleppe ([@aemkei](http://twitter.com/aemkei)) at [Ubilabs](http://ubilabs.net/). For more information -------------------- This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,22 @@ function( input, // input array size, // size (width and height) of stage output, i, neighbours // placeholders ){ // cycle through cells for (i = output = []; ++i < size*size;) { neighbours = // count neighbours input[i-size-1] + input[i-size] + input[i-size+1] + input[i-1 ] + input[i+1 ] + input[i+size-1] + input[i+size] + input[i+size+1]; output[i] = // live if it has 3 neighbours neighbours == 3 || // stay alive if it has 2 neighbours (input[i] && neighbours == 2); } return output; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ function (a,b,c,d,e){for(d=c=[];d++<b*b;)e=a[d-b-1]+a[d-b]+a[d-b+1]+a[d-1]+a[d+1]+a[d+b-1]+a[d+b]+a[d+b+1],c[d]=e==3||a[d]&&e==2;return c} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,8 @@ <!DOCTYPE html> <head> <title>Game of Life</title> <style type="text/css" media="screen"> #stage { line-height:12px; } @@ -15,76 +13,48 @@ width: 10px; height: 10px; margin: 1px 1px 0 0; background-color: #EEE; } #stage div.alive { background-color: #000; } </style> </head> <body> <div id="stage"></div> <script> var life = function(a,b,c,d,e){for(d=c=[];d++<b*b;)e=a[d-b-1]+a[d-b]+a[d-b+1]+a[d-1]+a[d+1]+a[d+b-1]+a[d+b]+a[d+b+1],c[d]=e==3||a[d]&&e==2;return c}, array = [], elems = {}, elem, stage = document.getElementById("stage"), size = 50, x, y; // create DOM elements for (x = 0; x < size; x++){ for (y = 0; y < size; y++){ elem = document.createElement("div"); stage.appendChild(elem); elems[x + "," + y] = elem; array.push(Math.random() < 0.5); } stage.appendChild(document.createElement("br")); } // render stage function play(){ var index = 0, color; array = life(array, size); for (x = 0; x < size; x++){ for (y = 0; y < size; y++){ elems[x + "," + y].className = array[index++] ? "alive" : ""; } } setTimeout(play, 10); } play(); </script> </body> -
aemkei revised this gist
Aug 14, 2011 . 3 changed files with 106 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,19 @@ function life(input, size, output, i, sum){ i = output = []; for (;i++ < size*size;) { sum = input[i-size-1] + input[i-size] + input[i-size+1] + input[i-1] + input[i+1] + input[i+size-1] + input[i+size] + input[i+size+1]; output[i] = sum == 3 || (input[i] && sum == 2) } return output; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ function (a,b,c,d,e){d=c=[];for(;d++<b*b;)e=a[d-b-1]+a[d-b]+a[d-b+1]+a[d-1]+a[d+1]+a[d+b-1]+a[d+b]+a[d+b+1],c[d]=e==3||a[d]&&e==2;return c} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,90 @@ <!DOCTYPE html> <head> <title>Foo</title> <style type="text/css" media="screen"> #stage { line-height:12px; } #stage div{ display: block; float: left; width: 10px; height: 10px; margin: 1px 1px 0 0; background-color: #000; } #stage div.dead { background-color: #EEE; } </style> </head> <body> <div id="stage"></div> <script src="annotated.js" type="text/javascript" charset="utf-8"></script> <script> (function(){ var array = [], elems = {}, elem, stage = document.getElementById("stage"); size = 40; function randomize(){ for (var x=0; x<size; x++){ for (var y=0; y<size; y++){ array.push(Math.random() < .5); } } } function render(array){ var index = 0, color; for (var x=0; x<size; x++){ for (var y=0; y<size; y++){ elems[x + "," + y].className = array[index++] == 1 ? "alive" : "dead"; } } } for (var x=0; x<size; x++){ for (var y=0; y<size; y++){ elem = document.createElement("div"); stage.appendChild(elem); elem.title = x + "," + y; elems[x + "," + y] = elem; array.push(Math.random() < .5 ? 1 : 0); } elem = document.createElement("br"); stage.appendChild(elem); } randomize(); function play(){ array = life(array, size); render(array); setTimeout(play, 20); } play(); })(); </script> </body> -
140bytes revised this gist
Jul 28, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ All entries must also be licensed under the [WTFPL](http://sam.zoy.org/wtfpl/) o For more information -------------------- See the [140byt.es](http://140byt.es) site for a showcase of entries (built itself using 140-byte entries!), and follow [@140bytes](http://twitter.com/140bytes) on Twitter. To learn about byte-saving hacks for your own code, or to contribute what you've learned, head to [the wiki](https://github.com/jed/140bytes/wiki/Byte-saving-techniques). -
140bytes revised this gist
Jul 28, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,8 +25,8 @@ All entries must also be licensed under the [WTFPL](http://sam.zoy.org/wtfpl/) o For more information -------------------- See the [140byt.es](http://140byt.es) for a showcase of entries built itself using 140-byte entries, and follow [@140bytes](http://twitter.com/140bytes) on Twitter. To learn about byte-saving hacks for your own code, or to contribute what you've learned, head to [the wiki](https://github.com/jed/140bytes/wiki/Byte-saving-techniques). 140byt.es is brought to you by [Jed Schmidt](http://jed.is), with help from Alex Kloss. It was inspired by work from [Thomas Fuchs](http://mir.aculo.us) and [Dustin Diaz](http://www.dustindiaz.com/). -
140bytes revised this gist
Jun 1, 2011 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,12 @@ <!DOCTYPE html> <title>Foo</title> <div>Expected value: <b>undefined</b></div> <div>Actual value: <b id="ret"></b></div> <script> // write a small example that shows off the API for your example // and tests it in one fell swoop. var myFunction = function(){ /* the code here should be identical to the entry. */ } document.getElementById( "ret" ).innerHTML = myFunction() </script> -
140bytes revised this gist
Jun 1, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ <!DOCTYPE html> <body> <div>Expected value: <b>undefined</b></div> <div>Actual value: <b id="ret"></b></div> -
140bytes revised this gist
May 31, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,5 +9,5 @@ var myFunction = function(){ /* the code here should be identical to the entry. */ } var ret = myFunction() document.getElementById( "ret" ).innerHTML = ret </script> -
140bytes revised this gist
May 31, 2011 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ <body> <div>Expected value: <b>undefined</b></div> <div>Actual value: <b id="ret"></b></div> </body> <script> // write a small example that shows off the API for your example // and tests it in one fell swoop. var myFunction = function(){ /* the code here should be identical to the entry. */ } var ret = myFunction() document.getElementById( "ret" ) = ret </script> -
140bytes revised this gist
May 31, 2011 . 3 changed files with 17 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,10 @@ function(){ // make sure // to annotate // your code // so everyone // can learn // from it! // see jed's entries // for examples. } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ function(){/* Your entry, a useful, unique, and valid JavaScript expression that packs as much functionality into 140 bytes as possible. */} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,13 @@ { "name": "theNameOfYourLibWhichMustBeAValidCamelCasedJavaScriptIdentifier", "description": "This should be a short description of your entry.", "keywords": [ "five", "descriptive", "keywords", "or", "fewer" ] } -
140bytes revised this gist
May 26, 2011 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ function(){ /* Rules: (1) anonymous function or IIFE // make sure (2) may execute immediately // to annotate (3) <=140 bytes // your code (4) no globals // so everyone (5) permissive license // can learn (6) have a good time! // from it! */} -
140bytes revised this gist
May 25, 2011 . 3 changed files with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Rules ----- All entries must exist in an `index.js` file, whose contents are 1. an assignable, valid Javascript expression that 2. contains no more than 140 bytes, and 3. does not leak to the global scope. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ function(){ /* Rules: (1) anonymous function // make sure (2) may execute immediately // to annotate (3) <=140 bytes // your code (4) no globals // so everyone (5) permissive license // can learn (6) have a good time! // from it! */} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ function(){/******************************************************************************************************************************/} -
140bytes revised this gist
May 23, 2011 . 2 changed files with 14 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,13 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ All entries must exist in an `index.js` file, whose contents are 2. contains no more than 140 bytes, and 3. does not leak to the global scope. All entries must also be licensed under the [WTFPL](http://sam.zoy.org/wtfpl/) or equally permissive license. For more information -------------------- -
140bytes revised this gist
May 23, 2011 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,12 +16,11 @@ Rules ----- All entries must exist in an `index.js` file, whose contents are 1. an assignable, valid Javascript expression, that 2. contains no more than 140 bytes, and 3. does not leak to the global scope. All entries must also be licensed under a license as or more permitting than the MIT license. For more information -------------------- -
140bytes revised this gist
May 22, 2011 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,8 @@ How to play 2. Modify all the files to according to the rules below. 3. Save your entry and tweet it up! Keep in mind that thanks to the awesome sensibilities of the GitHub team, gists are just repos. So feel free to clone yours and work locally for a more comfortable environment, and to allow commit messages. Rules ----- All entries must exist in an `index.js` file, whose contents are -
140bytes revised this gist
May 21, 2011 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,4 +26,6 @@ For more information The [140byt.es](http://140byt.es) site hasn't launched yet, but for now follow [@140bytes](http://twitter.com/140bytes) on Twitter. To learn about byte-saving hacks for your own code, or to contribute what you've learned, head to [the wiki](https://github.com/jed/140bytes/wiki/Byte-saving-techniques). 140byt.es is brought to you by [Jed Schmidt](http://jed.is). It was inspired by work from [Thomas Fuchs](http://mir.aculo.us) and [Dustin Diaz](http://www.dustindiaz.com/).
NewerOlder