Skip to content

Instantly share code, notes, and snippets.

View marshallswain's full-sized avatar
😄

Marshall Thompson marshallswain

😄
View GitHub Profile
@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 / 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 / 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 / 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);
}
<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 / app.js
Created April 3, 2017 17:46 — forked from silvestreh/app-index.js
Integrate Nuxt into Feathers
// src/app.js
/**
* There's not much to do here. Just remove or comment out
* the lines that use feathers.static (the public/ directory)
*/
app.use('/', feathers.static(app.get('public'))); // Find and remove this line
@marshallswain
marshallswain / default.json
Last active April 6, 2017 20:56
Example FeathersJS authentication config with `jwt` and `local` authentication
{
"host": "localhost",
"port": 3030,
"public": "../public/",
"paginate": {
"default": 10,
"max": 50
},
"authentication": {
"secret": "jcOPTCaY9ikyp5emSA4ChcF3Q3Pytwmadr6G954JDO8XURb5LW1btEOZ2CVgeCOe",
@marshallswain
marshallswain / authentication.js
Created April 6, 2017 20:57
Example FeathersJS authentication.js setup with `jwt` and `local` authentication
'use strict';
const authentication = require('feathers-authentication');
const jwt = require('feathers-authentication-jwt');
const local = require('feathers-authentication-local');
module.exports = function() {
const app = this;
const config = app.get('authentication');
@marshallswain
marshallswain / users.service.js
Created April 6, 2017 20:59
FeathersJS: Set up and endpoint to handle "mixed auth"
'use strict';
const { authenticate } = require('feathers-authentication').hooks;
const { hashPassword } = require('feathers-authentication-local').hooks;
// Bring in the `iff` hook.
const { iff } = require('feathers-hooks-common');
module.exports = {
before: {
find: [
@marshallswain
marshallswain / express-headers.json
Last active May 5, 2020 05:11
Feathers Client request headers using Socket.io, Express and Primus
{
"accept": "application/json, text/javascript, */*; q=0.01",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US,en;q=0.8,cy;q=0.6",
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6ImFjY2VzcyJ9.eyJ1c2VySWQiOiI0akZ4SEtQWXRpcnVwMkROIiwiaWF0IjoxNDkxNTM3ODExLCJleHAiOjE0OTE2MjQyMTEsImF1ZCI6Imh0dHBzOi8veW91cmRvbWFpbi5jb20iLCJpc3MiOiJmZWF0aGVycyIsInN1YiI6ImFub255bW91cyJ9.zOqO6bUgQrsMy7JIea6eoDCrMUqnIj2qKE8CPFOvhsQ",
"cache-control": "no-cache",
"connection": "keep-alive",
"content-length": "31",
"content-type": "application/json",
"host": "localhost:3030",