Last active
November 12, 2021 15:20
-
-
Save gre/9364718 to your computer and use it in GitHub Desktop.
Revisions
-
gre revised this gist
Mar 5, 2014 . 1 changed file with 8 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,11 +1,6 @@ JS1K Boilerplate --- Build tools --- @@ -26,6 +21,13 @@ It will give you some stats: 5739 source.js ``` Suggestion --- - Fork this gist - Clone your fork (with git) - Push your code to it - Share it to people / show it running with **http://bl.ocks.org/[yourusername]/[gistid]** --- DWTFYW license -
gre revised this gist
Mar 5, 2014 . 2 changed files 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 @@ -4,7 +4,7 @@ JS1K template - Fork this gist - Clone your fork (with git) - Push your code to it - Share it to people / show it running with **http://bl.ocks.org/[yourusername]/[gistid]** Build tools --- 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,3 @@ // Template of source code // Following code is just a suggestion -
gre created this gist
Mar 5, 2014 .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,32 @@ JS1K template --- - Fork this gist - Clone your fork (with git) - Push your code to it - Share it to people / show it running with **http://bl.ocks.org/<yourusername>/<gistid>** Build tools --- Install tools ```bash npm install ``` Then run it with: ```bash npm run build ``` It will give you some stats: ``` 1008 crushed.js 1704 minified.js 5739 source.js ``` --- DWTFYW license 2014 - @greweb 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,51 @@ <!doctype html> <html> <head> <title>JS1k, [COMPO] demo submission [ID]</title> <meta charset="utf-8" /> <style> html, body { margin: 0; padding: 0; border: 0; } #c { display: block; } /* kill scrollbars from hell */ </style> </head> <body> <canvas id="c"></canvas> <script> var a = document.getElementsByTagName('canvas')[0]; var b = document.body; var d = function(e){ return function(){ e.parentNode.removeChild(e); }; }(a); // unprefix some popular vendor prefixed things (but stick to their original name) var AudioContext = window.AudioContext || window.webkitAudioContext; var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(f){ setTimeout(f, 1000/30); }; // fix bug in safari: http://qfox.nl/weblog/218 document.body.clientWidth; // auto resize (original) canvas. call `onresize(w,h) to limit the size of the canvas (window.onorientationchange = window.onresize = function(a){ var mw = false; var mh = false; var max = Math.max; return function(w,h){ if (arguments.length === 2) { mw = w; mh = h; } a.style.width = (a.width = max(mw, innerWidth)) + 'px'; a.style.height = (a.height = max(mh, innerHeight)) + 'px'; }; }(a))(); var c = a.getContext('2d'); </script> <script type="text/javascript" src="source.js"></script> </body> </html> 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,11 @@ { "name": "js1k_template", "version": "0.0.0", "devDependencies": { "uglify-js": "2.4.x", "jscrush": "0.0.0" }, "scripts": { "build": "cat source.js | uglifyjs -c unused=false | tee minified.js | jscrush > crushed.js && wc -c *.js" } } 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,12 @@ // Template of source code // Following code is just a suggestion t = 0; L = function () { setTimeout(L, 9); c.fillRect(0, 10, t++, 50); } L();