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
| $("#button").bind("touchstart", function(e) { | |
| $(this).addClass("active"); | |
| }); | |
| $("#button").bind("touchend", function(e) { | |
| $(this).removeClass("active"); | |
| }); |
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
| border: 1px solid rgba(121,83,62,0.5); | |
| color: #fff; | |
| background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(246,171,89)), color-stop(0.5, rgb(242,117,54)), color-stop(0.51, rgb(242,104,31)), color-stop(1, rgb(242,131,73))); |
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
| div { | |
| display: grid; | |
| grid-module: 50px 30px; | |
| grid-gutter: 21px; | |
| grid-x-count: 10md; | |
| grid-columns: 3md, 1fr, 2md; | |
| grid-fields: 3md, auto, 1md; | |
| } |
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 element = document.createElement("div"); | |
| var shadow = new ShadowRoot(element); // {element} now has shadow DOM | |
| subtree, and {shadow} is its root. | |
| shadow.appendChild(document.createElement("p")).textContent = "weee!!'; |
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
| Widget subclass: #Counter | |
| instanceVariableNames: 'count header' | |
| category: 'Examples' | |
| decrease | |
| count := count - 1. | |
| header contents: [:html | html with: count asString] | |
| increase | |
| count := count + 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
| var o = myProto <| { | |
| a: 0, | |
| b: function () {} | |
| } | |
| var yehuda = man <| { | |
| firstName: "Yehuda", | |
| lastName: "Katz" | |
| } |
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
| // create the "stage" (root container) | |
| stage = Sprite3D.createCenteredContainer(); | |
| // create the container that will be used to rotate its children, and add it to the stage | |
| container = new Sprite3D().setZ(-00).rotateX(-20).update(); | |
| stage.addChild( container ); | |
| // create front left face | |
| container.addChild( | |
| new Sprite3D() |
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
| class example.Person | |
| constructor: (@first, @last) -> | |
| getFirst: -> @first | |
| setFirst: (first) -> @first = first | |
| getLast: -> @last |
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
| // Eliminating code | |
| var hascan = require('hascan'); | |
| var sourceCode = 'if (has("svg")) { a() } else if (has("canvas")) { b() } else { c() }'; | |
| var featureMap = {svg: false, canvas: true}; | |
| var smallerCode = hascan.eliminateFeatureTests(sourceCode, featureMap); | |
| console.log(smallerCode); | |
| // prints: {b()} | |
| // Getting features supported by a user-agent | |
| var hascan = require('hascan'); |
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 inputElement = document.getElementById ('api-example'); | |
| inputElement.addSpellcheckRange | |
| ( | |
| 4, | |
| 9, | |
| ['Chrome', 'Firefox', 'Opera', 'Internet Explorer'] | |
| ); |