Skip to content

Instantly share code, notes, and snippets.

View phillipskevin's full-sized avatar

Kevin Phillips phillipskevin

View GitHub Profile
return new Proxy(this, {
get: function(target, prop) {
var funcOrProp = target[prop];
if (typeof funcOrProp === 'function') {
return function() {
var result = funcOrProp.apply(target, arguments);
console.log(prop + '(' + [].join.call(arguments, ',') + ') -> ' + JSON.stringify(result));
return result;
}
@phillipskevin
phillipskevin / index.js
Last active December 13, 2016 16:50
steal-tools-build-using-steal-clone
import clone from 'steal-clone';
@phillipskevin
phillipskevin / npm-publish-dates.js
Created November 21, 2016 21:04
List when the dependencies of your project were published
const npm = require('npm');
const publishTimes = {};
function getInfo(name, version) {
return new Promise((resolve) => {
npm.info(name, (err, info) => {
const times = typeof info[version] === 'object' ? info[version].time : {};
resolve(`${name}@${version}|${times[version]}`);;
});
<script src="../node_modules/steal/steal.js">
window.rerun = true;
function rerunIfSuccessful() {
var result = document.getElementById('qunit-testresult');
var failed = result.getElementsByClassName('failed');
if (!failed.length) {
setTimeout(rerunIfSuccessful, 4000);
} else if (failed[0].innerHTML === "0" && window.rerun) {
location.reload(true);
}
@phillipskevin
phillipskevin / _Forms with CanJS 2.3 Stache Syntax.md
Last active August 15, 2018 19:28
Forms with New Stache Syntax

Forms with CanJS 2.3 Stache Syntax

This gist shows examples of how to handle different types of form elements with the new stache binding syntax in CanJS 2.3.

@phillipskevin
phillipskevin / unit-test-dependency-injection-using-stealjs.js
Created September 8, 2015 00:41
Example QUnit Test using StealJS for Dependency Injection
import QUnit from 'steal-qunit';
QUnit.module('Tournament Details ViewModel', {
beforeEach: function () {
localStorage.clear();
}
});
test('should load a tournament', (assert) => {
let done = assert.async(),