Skip to content

Instantly share code, notes, and snippets.

View marshallswain's full-sized avatar
😄

Marshall Thompson marshallswain

😄
View GitHub Profile
<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) {
@marshallswain
marshallswain / feathers-channels.js
Last active February 1, 2017 00:09
Event Management for Feathers Buzzard Release
const app = {};
class Channel {
constructor () {
this.connections = [];
}
add (connection) {
this.connections.push(connection);
}
@marshallswain
marshallswain / check-yarn.js
Last active April 8, 2017 05:26
Check if Yarn is installed.
const cmd = require('child_process').execSync;
var yarnInstalled;
try {
cmd('yarn bin').toString();
yarnInstalled = true;
} catch (err) {
yarnInstalled = false;
}
@marshallswain
marshallswain / bitcentive.md
Last active November 11, 2016 18:59
Bitcentive Guide

Bitcentive

High Level Architecture

Server and Services

  • Feathers
  • feathers-mongoose
    • only used for the model validation
@marshallswain
marshallswain / app.js
Last active July 14, 2016 13:27
Choo todo demo with needed scripts
/* global window, document, choo, yo, extend */
// const extend = require('xtend');
var html = yo;
const app = choo();
const store = {
getAll: (storeName, cb) => {
try {
cb(JSON.parse(window.localStorage[storeName]));
} catch (e) {
@marshallswain
marshallswain / feathersjs-auth0.js
Created June 4, 2016 20:49 — forked from john-evangelist/feathersjs-auth0.js
A hook to populate an user from Auth0 into feathersjs
const request = require('request-promise');
const errors = require('feathers-errors');
const options = {
idField: 'sub',
issuer: 'iss'
};
module.exports = function() {
@marshallswain
marshallswain / example-usage.js
Last active May 17, 2022 00:34
A FeathersJS hook to implement `findOrCreate`
const findOrCreate = require('./hook.find-or-create.js')
app.service('messages').hooks({
before: {
create: [findOrCreate()]
}
})
@marshallswain
marshallswain / qtip.stache
Created January 28, 2016 18:25
qtip2 idea
https://www.npmjs.com/package/qtip2
<td qtip>content</td>
<div class="qtip">here is popover content</div>
<td qtip qtip-selector="qtip">content</td>
<td>
content
@marshallswain
marshallswain / validation.stache
Last active September 22, 2015 21:34
Validation Ideas
viewModel = {
// Added implicitly
validation: {
comment: [],
username: {
required: "Username is required."
}
}
@marshallswain
marshallswain / live-binding-opt-out.js
Created July 5, 2015 21:36
Live Binding Opt Out Helper
// Opt out of live binding by not using the property's compute.
// Usage: {{~ 'propName'}}
can.stache.registerHelper('~', function(prop, options) {
return options.context[prop];
});