Skip to content

Instantly share code, notes, and snippets.

View arcseldon's full-sized avatar

Richard Seldon arcseldon

View GitHub Profile
var jwt = require('jsonwebtoken')
var socketjwt = require('socketio-jwt')
module.exports.issueToken = function(payload){
var token = jwt.sign(payload,sails.config.session.secret)
return token;
}
module.exports.verifyToken = function(token,verified){
//issue a token, with an expiration date
var jwt = require('jsonwebtoken')
//issue token that expires after 10 mins AND has an issuer
var token = jwt.sign('helloworld','secret',{ expiresInMinutes : 10, issuer : 'hipster.io'});
//verify token, but don't check assertions.
/**
* sails-jwt-auth configuration and devdocs
*
*
*/
/**
@arcseldon
arcseldon / gulpfile.js
Created December 16, 2015 12:53 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@arcseldon
arcseldon / .eslintrc.js
Created December 19, 2015 10:17 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@arcseldon
arcseldon / ramda
Created January 28, 2016 17:50 — forked from raine/ramda
Browse Ramda documentation in Terminal
#!/usr/bin/env bash
# Browse Ramda documentation in Terminal
# Requires jq and a tool such as fzf or peco for interactive filtering
LATEST="http://raine.github.io/ramda-json-docs/latest.json"
DOCS_URL="http://ramdajs.com/docs/"
json=$(curl -s $LATEST)
functions=$(echo "$json" | jq -r '.[] | if .sig and (.sig | length > 0) then .name + " :: " + .sig else .name end')
@arcseldon
arcseldon / free-er.js
Created February 28, 2016 06:29 — forked from DrBoolean/free-er.js
Free(er) monads in JS (pt 1)
const daggy = require('daggy')
const compose = (f, g) => x => f(g(x))
const id = x => x
const kleisli_comp = (f, g) => x => f(x).chain(g)
//=============FREE=============
const Free = daggy.taggedSum({Impure: ['x', 'f'], Pure: ['x']})
const {Impure, Pure} = Free
@arcseldon
arcseldon / free-er2.js
Created February 28, 2016 06:29 — forked from DrBoolean/free-er2.js
Free(er) Monads Pt2
const daggy = require('daggy')
const Task = require('data.task')
const _ = require('lodash')
const kleisli_comp = (f, g) => x => f(x).chain(g)
const compose = (f, g) => x => f(g(x))
const id = x => x
//=============FREE=============
const Free = daggy.taggedSum({Impure: ['x', 'f'], Pure: ['x']})
const {Impure, Pure} = Free
@arcseldon
arcseldon / .eslintrc
Created April 29, 2016 14:57 — forked from hendrikswan/.eslintrc
Packages and build config for Build Cross Platform React Native Apps with Exponent and Redux
{
"extends": "airbnb/base",
"plugins": [
"react"
],
"env": {
"node": true,
"jasmine": true,
},
"rules": {
@arcseldon
arcseldon / Option1.js
Created November 8, 2016 00:39 — forked from pushpabrol/Option1.js
How to use ldapjs within a custom database connection in Auth0
function login(email, password, callback) {
var ldap = require('ldapjs');
if (!global.ldapClient) {
// console.log('Global Client not found');
var client = ldap.createClient({
url: 'ldap://server:389',
idleTimeout: 30000
});
client.bind('uid=admin,ou=system', 'secret', function(err) {