Skip to content

Instantly share code, notes, and snippets.

View garth's full-sized avatar

Garth Williams garth

View GitHub Profile
@garth
garth / private.xml
Created October 21, 2013 18:39
To use a UK PC keyboard with a mac. Install UK layout (http://liyang.hu/osx-british.xhtml) and select PC British (105 alt) in keyboard settings. Then install KeyRemap4MacBook (https://pqrs.org/macosx/keyremap4macbook/index.html.en). Add the following to the private xml and select Fix Euro, PC Style End/Home #2 and PC Style PageUp/PageDown.
<?xml version="1.0"?>
<root>
<item>
<name>Fix Euro</name>
<identifier>private.fix_euro</identifier>
<autogen>__KeyToKey__ KeyCode::KEY_4, VK_OPTION, KeyCode::KEY_2, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L</autogen>
</item>
</root>
@garth
garth / Gruntfile.js
Created November 13, 2013 15:06
Grunt task to wait for a port to become open
'use strict';
var portscanner = require('portscanner');
var port = 3001;
module.exports = function (grunt) {
grunt.registerTask('waitForPort', 'Waits until a port is open', function() {
grunt.log.write('Waiting to the development server to come online...');
var done = this.async();
@garth
garth / emberViewExtension.js
Created December 30, 2013 16:01
Add support for keyboard shortcuts in emberjs views. Include keymaster.js and emberViewExtension.js and then see the example usage.
// enable keyboard shortcuts in views
Ember.View.reopen({
bindKey: function (shortcut, action) {
var controller = this.controller;
window.key(shortcut, function () {
controller.send(action);
});
},
unbindKey: function (shortcut) {
window.key.unbind(shortcut);
@garth
garth / SetIssueToResolved.sql
Last active August 29, 2015 14:04
JIRA issue resolution fixes
-- be sure to find out what the actual issues status number is for your workflow
update [jira].[dbo].[jiraissue]
set RESOLUTION = 10000, RESOLUTIONDATE = GETDATE()
where issuestatus = 10002 and resolution is null
Ember.Handlebars.registerBoundHelper('render-dynamic', function (name, context, options) {
// name was passed as a variable, but should be passed to render as a string
options.types[0] = "STRING";
return Ember.Handlebars.helpers.render.call(this, name, context, options);
});
@garth
garth / Grunt-HTMLBars.js
Last active August 29, 2015 14:11
Grunt task to pre-compile HTMLBars templates
'use strict';
var fs = require('fs');
var path = require('path');
var templateCompiler = require('./bower_components/ember/ember-template-compiler');
var templatesPath = 'templates'
module.exports = function (grunt) {
grunt.initConfig({
@garth
garth / chaiCounter.js
Created November 16, 2015 09:23
A wrapper for chai that adds a count of the number times expect is called.
import { expect as chai } from 'chai';
let expected = null;
let actual = 0;
export default {
expect(target) {
actual++;
return chai(target);
@garth
garth / .bablerc
Created December 30, 2015 23:07
babel v6 setup
{
"presets": ["react", "es2015", "stage-1"],
"plugins": ["transform-decorators-legacy"],
"env": {
"development": {
"plugins": [
["react-transform", {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
@garth
garth / .eslintrc
Created January 2, 2016 13:17
.eslintrc for cerebral-snabbdom
{
"parser": "babel-eslint", // https://github.com/babel/babel-eslint
"env": {
"node": true
},
"globals": {},
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
@garth
garth / debounce.md
Last active March 16, 2016 20:26
cerebral-addons: calling debounce() without options has been temporarily deprecated.

before v0.6.x

The current default implementation of debounce is actually closer to throttle. We plan to transition the current behaviour to throttle, and change the deault behavour of debounce in the next major release.

Until version 0.6.x is released the following will give a deprecation warning:

signal('fieldChanged', [