This file contains 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
// Modified from https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove#Polyfill | |
[ | |
Element.prototype, | |
CharacterData.prototype, | |
DocumentType.prototype, | |
].forEach(function (proto) { | |
if (!proto.hasOwnProperty('remove')) { | |
Object.defineProperty(proto, 'remove', { | |
configurable: true, | |
enumerable: true, |
This file contains 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 fill = d3.scale.category20(); | |
var layout = d3.layout.cloud() | |
.size([500, 500]) | |
.words([ | |
"Hello", "world", "normally", "you", "want", "more", "words", | |
"than", "this"].map(function(d) { | |
return {text: d, size: 10 + Math.random() * 90, test: "haha"}; | |
})) | |
.padding(5) | |
.rotate(function() { return ~~(Math.random() * 2) * 90; }) |
A quick reference list of ::-ms-*
prefixed pseudo elements.
pseudo element | file | text | checkbox | radio | select | range | password | progress |
---|---|---|---|---|---|---|---|---|
::-ms-browse | ☑ | |||||||
::-ms-check | ☑ | ☑ | ||||||
::-ms-clear | ☑ | |||||||
::-ms-expand | ☑ | |||||||
::-ms-fill | ☑ | |||||||
::-ms-fill-lower | ☑ |
This file contains 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 () { | |
var hashAnchors = document.querySelectorAll('a[href^="#"]'); | |
/* | |
Legacy browsers don't support NodeList.prototype.forEach, | |
so we have to call Array.prototype.forEach setting the | |
context to the NodeList. | |
*/ | |
[].forEach.call(hashAnchors, function (anchor) { | |
anchor.addEventListener('click', function (event) { |
This file contains 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
#!/usr/bin/env node | |
'use strict'; | |
const Hexo = require('hexo'); | |
const YAML = require('js-yaml'); | |
const fs = require('fs'); | |
const cwd = process.cwd(); | |
exports.hexo = new Hexo(cwd); |
A collection of resources for developing native web apps.
This file contains 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 currencyToPennies (currency) { | |
// ensure string | |
var strCurrency = currency.toString(); | |
// ignore any character that's not part of a number | |
var wholeAmount = strCurrency.replace(/[^0-9.]/g, ''); | |
// locate decimal | |
var decimalIndex = wholeAmount.indexOf('.'); | |
var normalizedAmount; |
This file contains 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
app.directive('myOldDirective', function (myNewDirective) { | |
var warnMsg = 'DEPRECATION WARNING: myOldDirective has been marked as deprecated ' + | |
'and will be removed in a future release. ' + | |
'Please use myNewDirective as a replacement.'; | |
console.warn(warnMsg); // jshint ignore:line | |
return myNewDirective[0]; | |
}); |
Items in bold are those that I have the most experience.
- bundler - It manages your project's gem versions, so you don't have to. If you aren't using it, see me after class ಠ_ಠ