Skip to content

Instantly share code, notes, and snippets.

View marshallswain's full-sized avatar
😄

Marshall Thompson marshallswain

😄
View GitHub Profile
@marshallswain
marshallswain / can-set-api.js
Last active May 6, 2017 00:18
Proposal for new can-set API (Rought Draft)
var set = require('can-set');
// The current API
var algebra = new set.Algebra(
// specify the unique identifier on data
set.props.id("_id"),
// specify that completed can be true, false or undefined
set.props.boolean("retired"),
// specify properties that define pagination
set.props.rangeInclusive("start","end"),
@marshallswain
marshallswain / birds.md
Last active May 2, 2017 20:48
Birds A-Z
@marshallswain
marshallswain / readme.md
Created April 17, 2017 12:40
FeathersJS: Better permissions

Better Permissions Control

We have introduced 3 new hooks and 2 new middleware as part of feathers-permissions that give you much more flexibility and control over access permissions than was previously possible. Permissions are stored in the database on the entity record that needs to have access permissions checked (typically a user). They look like this:

[
    '*', // all services, all methods, all docs
    'users:*', // all methods on users service
    'users:remove:*', // can remove any user
    '*:remove', // can remove on any service
@marshallswain
marshallswain / launch.json
Last active July 1, 2019 20:10
Setting up Visual Studio Code to work with Nuxt.js
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "npm run dev",
"runtimeExecutable": "npm",
"windows": {
"runtimeExecutable": "npm.cmd"
@marshallswain
marshallswain / authentication.js
Last active September 24, 2021 08:59
Example tools for using querystring redirects with Feathers OAuth login.
'use strict';
const authentication = require('feathers-authentication');
const jwt = require('feathers-authentication-jwt');
const local = require('feathers-authentication-local');
const oauth2 = require('feathers-authentication-oauth2');
const GithubStrategy = require('passport-github');
// Bring in the oauth-handler
const makeHandler = require('./oauth-handler');
@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",
@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 / 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 / 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 / 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