What led me to use automatic semi-colon insertion (aside from not having to hit the semi-colon button);
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 characters
| w=b.offsetWidth | |
| h=b.offsetHeight | |
| wh=Math.sqrt(w*w+h*h) | |
| s=b.style | |
| s.background='#222' | |
| q=Math.random | |
| n=30 | |
| i=n | |
| r=[] //rectangles |
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 characters
| var internals = { | |
| revEngine : function rev( state, engine ) { | |
| state.timesRevved++ | |
| switch( engine ) { | |
| case "v8": | |
| console.log("vrooooooooom!") | |
| break |
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 characters
| var e = function( iterations ) { | |
| var aggregator = 1 | |
| for( var i=1; i < iterations; i++ ) { | |
| var value=1; | |
| for( var j=2; j <= i; j++ ) { | |
| value *= 1 / j |
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 characters
| //Copy/paste into your console | |
| (function() { | |
| var t = 0 | |
| var values = [] | |
| var msg = [] | |
| function loop() { | |
| t++ | |
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 characters
| function logger( state, msg ) { | |
| state.count++ | |
| console.log( state.count, this.msg ) | |
| } | |
| var log = () => logger( {count:0}, "Calling from an arrow function" ) | |
| log() | |
| log() | |
| log() |
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 characters
| function createNamedObject( fn, obj ) { | |
| return _.extend(new fn(), obj) | |
| } | |
| var api = { | |
| get: function() {}, | |
| set: function() {}, | |
| save: function() {} | |
| } | |
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 characters
| #Run: gif.sh file.mov 320 | |
| #Outputs a file.gif at 320px wide | |
| OUT=$(echo $1 | sed -e 's/\.[a-zA-Z0-9]*$/.gif/') | |
| ffmpeg -i "$1" -vf scale=${2:-640}:-1 -r 30 -f image2pipe -vcodec ppm - | convert -delay 5 -layers Optimize -loop 0 - "$OUT" |
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 characters
| //Use gl.POINTS to draw a dot | |
| uniform vec3 color; | |
| void main() { | |
| // Map ( [0,0] , [1,1] ) => ( [-1,-1], [1,1] ) | |
| vec2 coord = ( gl_PointCoord - vec2(0.5, 0.5) ) * 2.0; | |
| // Step it so that it's a hard transition |
WP_Query is the best way to grab posts in Wordpress, and it's a beast to configure. I created a few snippets in my text editor to help me create them quickly without having to navigate the difficult to read documentation. I've shared them here.