A few notes from Jennifer Campbell & Paul Gries' outstanding Coursera MOOC Crafting Quality Code
- examples
- type contract
- header
| 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 |
| sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app --nointeraction |
| 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); |
| <?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 |
| <?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 |
| 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) |
| // 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; | |
| } |
| function hexToBase65536(hex) { | |
| var result = ""; | |
| for (var i = hex.length ; i > 0; i -= 4) { | |
| result += String.fromCharCode(parseInt(hex.substring(i - 4, i), 16)); | |
| } | |
| return result; | |
| } |
A few notes from Jennifer Campbell & Paul Gries' outstanding Coursera MOOC Crafting Quality Code
| digraph situated_schema { | |
| name [color = red, style = filled] | |
| rankdir=LR | |
| "name" -> "name2" | |
| } |