Skip to content

Instantly share code, notes, and snippets.

View wilsonpage's full-sized avatar

Wilson Page wilsonpage

View GitHub Profile
View.prototype.fire = function(name) {
var args = [].slice.call(arguments, 1);
var parent = this.parent;
var propagate;
var event;
if (typeof name === 'object') {
name = name.name;
event = name.event;
}
'use strict';
/**
* Module Dependencies
*/
var raf = require('../device/raf');
/**
* Locals
@wilsonpage
wilsonpage / .profile
Last active December 27, 2015 15:19
Shell prompt with current Git branch. Add this code to a `.profile` file in your home directory for a more useful terminal prompt. You must have bash-completion installed: `$ brew install bash-completion`
function prom {
local GREEN="\[\033[0;32m\]"
local WHITE="\[\033[0m\]"
PS1="\w$GREEN\$(__git_ps1)$WHITE \$ "
}
prom
@wilsonpage
wilsonpage / gist:7359744
Created November 7, 2013 18:43
Autocomplete in Git
http://ihswebdesign.com/knowledge-base/bash-completion-git-branch-in-your-prompt-yes/
@wilsonpage
wilsonpage / umd-module.js
Last active August 19, 2016 13:18
UMD (amd, common.js, window)
;(function(define){define(function(require,exports,module){
//...
});})(typeof define=='function'&&define.amd?define
:(function(n,w){'use strict';return typeof module=='object'?function(c){
c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){
return w[n];},m.exports,m);w[n]=m.exports;};})('module-name',this));
.icon-foo:before {
font-family: 'icons';
content: 'foo'
}
<span class="icon-foo"></span>
@wilsonpage
wilsonpage / version-controlled-packages-in-gaia.md
Last active March 3, 2020 08:30
Version controlled packages in Gaia

Version controlled packages in Gaia

If you are a Gaia hacker, you have two choices when using Bower controlled packages: global or local.

Global

You can use shared/ just like any other Gaia shared piece of code. This means you always get the latest version of that package, this means that you run the risk of code changing, you're not depending on a locked version.

Updating packages in Gaia should be done/reviewed by the package owner. This is because they will have the best knowledge as to which apps are likely to be affected by the update, and whether any app changes are required to avoid breakage. The update steps, like all Bower controlled shared dependencies, are as follows:

function MyClass(external) {
this.external = external;
}
MyClass.prototype.publicMethod = function() {};
MyClass.prototype.privateMethod = function() {};
module.exports = function () {
var myClass = new MyClass(this);
@wilsonpage
wilsonpage / credit.md
Last active August 29, 2015 14:19 — forked from annevk/credit.md

After Ryosuke, Travis, Wilson, William, and I discussed the problem for an hour over a burrito, William came up with this approach. All hail William.

var XFooPrototype = {
createdCallback: function() {
this.createShadowRoot({ mode: 'open' });
new MutationObserver(() => distribute(this)).observe(this, { childList: true });
distribute(this);
}
}
function distribute(host) {
var slots = host.shadowRoot.querySelectorAll('content');