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 ಠ_ಠ
# config/routes.rb | |
Rails.application.routes.draw do | |
# use json if format not defined in url | |
scope(format: :json) do | |
get :hello, controller: :sandbox | |
end | |
end | |
# config/initializers/mime_types.rb | |
# Define a custom Vendor MIME type |
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; |
Items in bold are those that I have the most experience.
#!/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); |
(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) { |
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; }) |
// 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, |
A collection of resources for developing native web apps.
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]; | |
}); |