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
| addMouseEvents: function (){ | |
| this.canvas.addEventListener('mousedown', function(event){ | |
| console.log("mouse down"); | |
| }, false); | |
| this.canvas.addEventListener('mouseup', function(event){ | |
| console.log("mouse up"); | |
| }, false); | |
| } |
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
| neutralizeAnimationFunc: function(){ | |
| if(!window.requestAnimationFrame){ | |
| window.requestAnimationFrame = (window.webkitRequestAnimationFrame || | |
| window.mozRequestAnimationFrame || | |
| window.oRequestAnimationFrame || | |
| window.msRequestAnimationFrame || | |
| function(callback){ | |
| return window.setTimeout(callback, 1000/60); | |
| }); | |
| } |
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
| checkCanvasSupport: function(){ | |
| if(!document.createElement('canvas').getContext) { | |
| alert("This browser dosn't support the canvas element"); | |
| return false; | |
| }else{ | |
| console.log("success!"); | |
| return true; | |
| } | |
| }, |
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
| drawFrame: function(){ | |
| window.requestAnimationFrame(this.drawFrame, this.canvas); | |
| this.render(); | |
| }, |
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
| # configure a pipe rule | |
| sudo ipfw pipe 1 config bw 512Kbit/s delay 500ms | |
| # add the pipe to connection in and out port 80 | |
| sudo ipfw add 1 pipe 1 src-port 80 | |
| sudo ipfw add 2 pipe 1 dst-port 80 | |
| # remove the rules and delete the pipe | |
| sudo ipfw delete 1 | |
| sudo ipfw delete 2 |
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 err = new Error(); | |
| console.log(err.stack) |
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 shuffleArray(ary) { | |
| var i = ary.length, j, x; | |
| while (i) { | |
| j = Math.floor(Math.random() * i); | |
| i -= 1; | |
| x = ary[i]; | |
| ary[i] = ary[j]; | |
| ary[j] = x; | |
| } | |
| } |
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
| /* in header.php */ | |
| <?php touch('wp-content/themes/{your theme name}/{your template name}.php'); ?> |
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
| let aConstant: Int = 70 | |
| var aVariable: Int = 70 | |
| aConstant += 1 // Error! aConstant is not mutable | |
| aVariable += 1 |
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
| let numOfApples = 3 | |
| print("I have \(numOfApples) apples") |
OlderNewer