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
// Solution to eloquentjavascript exercise second 2nd edition | |
// Chapter 5 | |
// http://eloquentjavascript.net/2nd_edition/preview/05_higher_order.html | |
// Mother-child age difference | |
function average(array) { | |
function plus(a, b) { return a + b; } | |
return array.reduce(plus) / array.length; | |
} |
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 Plant() { | |
this.energy = 3 + Math.random() * 4; | |
} | |
Plant.prototype.act = function(context) { | |
if (this.energy > 19) { | |
var space = context.find(" "); | |
if (space) | |
return {type: "reproduce", direction: space}; | |
} | |
if (this.energy < 20) |
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
<?php | |
/* | |
Name - templated.php | |
Author - Shafiq Mustapa ([email protected]) | |
Usage - php templated.php | |
Stumble this upon site (http://templated.co)that offer over 800+ HTML5 + CSS + Responsive. | |
This php script will download the file automatically. For now, the page is now 7. | |
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 characters
<?php | |
/* | |
Name - templated.php | |
Author - Shafiq Mustapa ([email protected]) | |
Usage - php templated.php | |
Stumble this upon site (http://templated.co)that offer over 800+ HTML5 + CSS + Responsive. | |
This php script will download the file automatically. For now, the page is now 7. | |
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 characters
int[][] result; | |
float t, c; | |
float ease(float p) { | |
return 3*p*p - 2*p*p*p; | |
} | |
float ease(float p, float g) { | |
if (p < 0.5) | |
return 0.5 * pow(2*p, g); |
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
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app --nointeraction |
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
javascript:if (typeof(zapper) == "undefined") {window.zapper = {state: 1,over: null,selected: null,select: function(e) {zapper.selected = document.elementFromPoint(e.clientX, e.clientY);zapper.over=document.createElement("div");zapper.over.style="pointer-events:none;position:fixed;z-index:2147483647;background-color:#FF0000;opacity:0.5;";document.body.appendChild(zapper.over);var rect = zapper.selected.getBoundingClientRect();var overS=zapper.over.style;overS.left = rect.left+"px";overS.top = rect.top+"px";overS.width = rect.width+"px";overS.height = rect.height+"px";zapper.state = 2;},zap: function(e) {var selected2 = document.elementFromPoint(e.clientX, e.clientY);if (zapper.selected == selected2){console.log("zapping");selected2.parentElement.removeChild(selected2);}document.body.removeChild(zapper.over);zapper.state=3;console.log("done");}}; document.body.addEventListener("click", function(e){e.preventDefault();console.log("click");if (zapper.state == 1){zapper.select(e);} else if (zapper.state == 2) {zap |
OlderNewer