Revisions
-
Haochi Chen revised this gist
Jul 11, 2011 . 3 changed files with 15 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,23 +1,17 @@ function( a, // the template string c // the values ){ return a.replace(/{ *([^} ]+) *}/g, // searches for { variable_name } to replace function( // the replacer function b, // no use here. it holds the entire "{ variable_name }" string a // we will use this instead, it holds "variable_name" ){ b=c; // re-assign the placeholder to values a.replace(/[^.]+/g,function(a){ // find all the key names b=b[a] // one by one until it's reduced to the one we are looking for }); return b // return this value to be replaced } ) } 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,c){return a.replace(/{ *([^} ]+) *}/g,function(b,a){b=c;a.replace(/[^.]+/g,function(a){b=b[a]});return b})} 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 @@ -5,7 +5,7 @@ <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="http://code.jquery.com/qunit/git/qunit.js"></script> <script> var tofu = function(a,c){return a.replace(/{ *([^} ]+) *}/g,function(b,a){b=c;a.replace(/[^.]+/g,function(a){b=b[a]});return b})}; </script> <script> $(document).ready(function(){ -
Haochi Chen revised this gist
Jul 11, 2011 . 3 changed files with 24 additions and 26 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,25 +1,23 @@ function(c,e){ return c.replace(/{ *([^} ]+) *}/g, // searches for { variable_name } to replace function( // the replacer function c, // no use here. it holds the entire "{ variable_name }" string f // we will use this instead, it holds "variable_name" ){ for( var d=f.split("."), // split the variable, so we can access nested objects a=e,b=0;b<d.length; ) // loop through it and reassign the value to the next level. // each iteration will move "item" one level closer to the // actual value we are looking for. For example, if the // value of "match" is "place.name.translation", before // the for loop, "item" will be equal to the "values" object. // After the first iteration "item" will become "values.place", // after the second it will be "values.place.name", and at // the last iteration it will be "values.place.name.translation", // which is what we want. a=a[d[b++]]; return a // return the final value from the object and to let String.replace do its magic } ) }; 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(c,e){return c.replace(/{ *([^} ]+) *}/g,function(c,f){for(var d=f.split("."),a=e,b=0;b<d.length;)a=a[d[b++]];return a})}; 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 @@ -5,7 +5,7 @@ <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="http://code.jquery.com/qunit/git/qunit.js"></script> <script> var tofu = function(c,e){return c.replace(/{ *([^} ]+) *}/g,function(c,f){for(var d=f.split("."),a=e,b=0;b<d.length;)a=a[d[b++]];return a})}; </script> <script> $(document).ready(function(){ -
Haochi Chen revised this gist
Jul 11, 2011 . 2 changed files with 2 additions 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 @@ -21,6 +21,7 @@ and it will return `Welcome to Hong Kong! The current temperature is 20 degrees ## Gotchas There aren't really any gotchas, but I will just put it here. 1. I have made the key names for the values object is very forgiving, so you can write something like `tofu("{ *** }", { "***": "Hello, World!"})`. It should be able to accept any string (including symbols and non-Latin characters) as long as it doesn't include spaces or the closing curly brace (i.e. `}`). The reasoning is pretty obvious so I am not going to state it here. You can look at the source code for the exact regular expression. My empirical research shows that you won't have to worry about it 99.9999999% of the time. As a general rule of thumb, pretend like you are accessing a JavaScript object using dot notation and you should be fine. ## Why should you use Tofu? 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 @@ function tofu(template, values){ // pass the matched value "match" to the function. ("a" here // is just a placeholder, it includes the curly braces, while // "match" is just the variable name we will be using.) return template.replace(/{ *([^} ]+) *}/g, function(a, match){ // splits the variable name, so we can access nested object // using the familiar dot notation. var levels = match.split("."), -
Haochi Chen revised this gist
Jul 11, 2011 . 3 changed files with 28 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 @@ -5,7 +5,7 @@ Tofu takes two parameters: a string as template, and a object as values. Variabl `tofu("{ Ich } am { ein } Berliner", { Ich: "I", ein: "a" });` will return `I am a Berliner`. You can access nested object values through the familar dot notation that JavaScript uses, so you can do something like tofu("Welcome to { place.name }! The current temperature is { place.temperature.magnitude } degrees { place.temperature.unit }.", { place: { @@ -19,5 +19,9 @@ You can use access nested object values through the familar dot notation that Ja and it will return `Welcome to Hong Kong! The current temperature is 20 degrees Celcius.` ## Gotchas There aren't really any gotchas, but I will just put it here. 1. I have made the key names for the values object is very forgiving, so you can write something like `tofu("{ *** }", { "***": "Hello, World!"})`. It should be able to accept any string (including symbols and non-Latin characters) as long as it doesn't include spaces or the closing curly brace (i.e. `}`). The reasoning is pretty obvious so I am not going to state it here. You can look at the source code for the exact regular expression. My empirical research shows that you won't have to worry about it 99.9999999% of the time. As a general rule of thumb, pretend like you are accessing a JavaScript object using dot notation and you should be fine. ## Why should you use Tofu? Tofu is fast, tiny, and gets the job done if you don't need the fancy conditional and enumerable sections that mustache offers. 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 tofu(c,e){return c.replace(/{ *([^} ]+) *}/g,function(c,f){for(var d=f.split("."),a=e,b=0;b<d.length;b++)a=a[d[b]];return a})}; 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 @@ -5,7 +5,7 @@ <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="http://code.jquery.com/qunit/git/qunit.js"></script> <script> function tofu(c,e){return c.replace(/{ *([^} ]+) *}/g,function(c,f){for(var d=f.split("."),a=e,b=0;b<d.length;b++)a=a[d[b]];return a})}; </script> <script> $(document).ready(function(){ @@ -35,6 +35,26 @@ equals(expected_message, rendered_message); }); module("Fancy key names"); test("Invalid JavaScript variable name", function(){ var expected_message = "Tofu is yummy." , rendered_message = tofu("{ #@! } is { *** }.", { "#@!": "Tofu", "***": "yummy" }); equals(expected_message, rendered_message); }); test("Accented Latin characters", function(){ var expected_message = "Tofu is yummy." , rendered_message = tofu("{ á } is { ǽ }.", { "á": "Tofu", "ǽ": "yummy" }); equals(expected_message, rendered_message); }); test("Asian characters", function(){ var expected_message = "Hong Kong is part of China." , rendered_message = tofu("{ 香港 } is part of { 中國 }.", { "香港": "Hong Kong", "中國": "China" }); equals(expected_message, rendered_message); }); module("Misc."); test("Make sure the outgoing values are the same as the incoming values", function(){ var expected_message = "What does a cat do? It meows!", -
Haochi Chen revised this gist
Jul 10, 2011 . 1 changed file with 17 additions and 26 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,32 +1,23 @@ Tofu is a logic-less, tweet-size (minified) JavaScript templating engine similar to [mustache.js](https://github.com/janl/mustache.js), except that tofu is true logic-less. ## Usage Tofu takes two parameters: a string as template, and a object as values. Variables inside the template are surrounded by a pair of curly braces. `tofu("{ Ich } am { ein } Berliner", { Ich: "I", ein: "a" });` will return `I am a Berliner`. You can use access nested object values through the familar dot notation that JavaScript uses, so you can do something like tofu("Welcome to { place.name }! The current temperature is { place.temperature.magnitude } degrees { place.temperature.unit }.", { place: { name: "Hong Kong", temperature: { magnitude: 20, unit : "Celcius" } } }); and it will return `Welcome to Hong Kong! The current temperature is 20 degrees Celcius.` ## Why should you use Tofu? Tofu is fast, tiny, and gets the job done if you don't need the fancy conditional and enumerable sectiosn that mustache offers. -
Haochi Chen revised this gist
Jul 10, 2011 . 5 changed files with 104 additions and 33 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) 2011 Haochi Chen <http://ihaochi.com> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long @@ -10,4 +10,4 @@ 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 @@ -1,10 +1,25 @@ function tofu(template, values){ // searches for { variables } inside the template string, // pass the matched value "match" to the function. ("a" here // is just a placeholder, it includes the curly braces, while // "match" is just the variable name we will be using.) return template.replace(/{ *([\w\.]+) *}/g, function(a, match){ // splits the variable name, so we can access nested object // using the familiar dot notation. var levels = match.split("."), item = values; // each iteration will move "item" one level closer to the // actual value we are looking for. For example, if the // value of "match" is "place.name.translation", before // the for loop, "item" will be equal to the "values" object. // After the first iteration "item" will become "values.place", // after the second it will be "values.place.name", and at // the last iteration it will be "values.place.name.translation", // which is what we want. for(var i=0;i<levels.length;i++){ item = item[levels[i]]; } // then we return this value and let String.replace do its magic. return item; }); } 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 tofu(c,e){return c.replace(/{ *([\w\.]+) *}/g,function(c,f){for(var d=f.split("."),a=e,b=0;b<d.length;b++)a=a[d[b]];return a})}; 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,10 @@ { "name": "tofu", "description": "Tofu is a logic-less, tweet-size JavaScript templating engine.", "keywords": [ "tofu", "template" ] } 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,71 @@ <!DOCTYPE html5> <html> <head> <link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" /> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="http://code.jquery.com/qunit/git/qunit.js"></script> <script> function tofu(c,e){return c.replace(/{ *([\w\.]+) *}/g,function(c,f){for(var d=f.split("."),a=e,b=0;b<d.length;b++)a=a[d[b]];return a})}; </script> <script> $(document).ready(function(){ test("Simple object test", function() { equals("I am a Berliner", tofu("{Ich} am {ein} Berliner", {Ich: "I", ein: "a"})); }); module("Nested object values"); test("Simple test", function() { var expected_message = "Welcome to Hong Kong! The current temperature is 20 degrees Celcius." , template = "Welcome to { place.name }! The current temperature is { place.temperature.magnitude } degrees { place.temperature.unit }." , rendered_message = tofu(template, { place: { name: "Hong Kong", temperature: { magnitude: 20, unit : "Celcius" } } }); equals(expected_message, rendered_message); }); test("Multiple occurances", function(){ var expected_message = "A rose is a rose is a rose" , rendered_message = tofu("A { flower } is a { flower } is a { flower }", { flower: "rose" }); equals(expected_message, rendered_message); }); module("Misc."); test("Make sure the outgoing values are the same as the incoming values", function(){ var expected_message = "What does a cat do? It meows!", template = "What does a { animal.species.name } do? It { animal.species.action }!", values = { animal: { species: { name: "cat", action: "meows" }, some_other_stuff: "should still be here!" } }; equals(expected_message, tofu(template, values)); equals(template, "What does a { animal.species.name } do? It { animal.species.action }!"); deepEqual(values, { animal: { species: { name: "cat", action: "meows" }, some_other_stuff: "should still be here!" } }); }); }); </script> </head> <body> <h1 id="qunit-header">QUnit</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <div id="qunit-fixture">test markup, will be hidden</div> </body> </html> -
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/). -
140bytes revised this gist
May 18, 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 @@ -5,7 +5,7 @@ // [OPTIONAL] A description of your library, phrased as a verb predicate. // The gist description is used by default. "description": "Explain the 140byt.es rules.", // [OPTIONAL] Up to 5 keywords used for indexing. "keywords": [ -
140bytes revised this gist
May 18, 2011 . 1 changed file with 13 additions 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,4 +1,16 @@ { // [REQUIRED] A name for your library. // This must match /^[a-z_]\w*$/i "name": "140bytes", // [OPTIONAL] A description of your library, phrased as a verb predicate. // The gist description is used by default. "description": "Explain the 140byt.es rules." // [OPTIONAL] Up to 5 keywords used for indexing. "keywords": [ "140bytes", "master", "rules" ] } -
140bytes revised this gist
May 18, 2011 . 1 changed file with 3 additions 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 @@ -24,4 +24,6 @@ All entries must also be licensed under the MIT license. 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. 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/). -
140bytes revised this gist
May 18, 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 @@ -14,8 +14,8 @@ Rules ----- All entries must exist in an `index.js` file, whose contents are 1. a valid Javascript function expression, that 2. optionally self-executes, 2. contains no more than 140 bytes, and 3. does not pollute global scope. -
140bytes revised this gist
May 18, 2011 . 1 changed file with 12 additions 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 @@ -7,9 +7,20 @@ How to play ----------- 1. Click the  button above to fork this gist. 2. Modify all the files to according to the rules below. 3. Save your entry and tweet it up! Rules ----- All entries must exist in an `index.js` file, whose contents are 1. a valid Javascript function expression, that is 2. is optionally self-executing, 2. contains no more than 140 bytes, and 3. does not pollute global scope. All entries must also be licensed under the MIT license. For more information -------------------- -
140bytes revised this gist
May 18, 2011 . 1 changed file with 3 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,7 +1,7 @@ 140byt.es ========= A tweet-sized, fork-to-play, community-curated collection of JavaScript. How to play ----------- @@ -12,4 +12,5 @@ How to play 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. -
140bytes revised this gist
May 18, 2011 . 1 changed file with 14 additions 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,2 +1,15 @@ 140byt.es ========= All the Codes that Fits in Tweet How to play ----------- 1. Click the  button above to fork this gist. 2. Modify all the files to according to the rules and style guide below. 3. Save your entry and tweet it up! For more information -------------------- The 140byt.es site launched yet, but for now follow [@140bytes](http://twitter.com/140bytes) on Twitter, and keep you eye on http://140byt.es. -
140bytes revised this gist
May 18, 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 @@ -0,0 +1,2 @@ 140byt.es ========= -
140bytes revised this gist
May 18, 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,4 +1,4 @@ { "name": "140bytes", "keywords": [ "140bytes", "master", "rules" ] } -
140bytes revised this gist
May 18, 2011 . 1 changed file with 7 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,9 +1,9 @@ function(){ /* Rules: (1) anonymous function // make sure (2) may be self-executing // to annotate (3) <=140 bytes // your code (4) no globals // so everyone (5) MIT license // can learn (6) have a good time! // from it! */} -
140bytes revised this gist
May 18, 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 +1 @@ function(){/*Rules: (1) anonymous function (2) may be self-executing (3) <=140 bytes (4) no globals (5) MIT license (6) have a good time!*/} -
140bytes renamed this gist
May 18, 2011 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
140bytes revised this gist
May 18, 2011 . 1 changed file with 20 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,20 @@ Copyright (c) 2011 YOUR_NAME_HERE, YOUR_URL_HERE Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
NewerOlder