Skip to content

Instantly share code, notes, and snippets.

View dalmaer's full-sized avatar

Dion Almaer dalmaer

View GitHub Profile
$("#button").bind("touchstart", function(e) {
$(this).addClass("active");
});
$("#button").bind("touchend", function(e) {
$(this).removeClass("active");
});
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)));
div {
display: grid;
grid-module: 50px 30px;
grid-gutter: 21px;
grid-x-count: 10md;
grid-columns: 3md, 1fr, 2md;
grid-fields: 3md, auto, 1md;
}
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!!';
Widget subclass: #Counter
instanceVariableNames: 'count header'
category: 'Examples'
decrease
count := count - 1.
header contents: [:html | html with: count asString]
increase
count := count + 1.
var o = myProto <| {
a: 0,
b: function () {}
}
var yehuda = man <| {
firstName: "Yehuda",
lastName: "Katz"
}
// 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()
class example.Person
constructor: (@first, @last) ->
getFirst: -> @first
setFirst: (first) -> @first = first
getLast: -> @last
// 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');
var inputElement = document.getElementById ('api-example');
inputElement.addSpellcheckRange
(
4,
9,
['Chrome', 'Firefox', 'Opera', 'Internet Explorer']
);