View tokenAuth.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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){ |
View assertions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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. |
View configSlashtoken.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* sails-jwt-auth configuration and devdocs | |
* | |
* | |
*/ | |
/** |
View gist:11569343ae2e3b6ea0bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sails lift --verbose | |
info: Starting app... | |
verbose: Setting Node environment... | |
verbose: moduleloader hook loaded successfully. | |
verbose: Loading app config... | |
verbose: userconfig hook loaded successfully. | |
verbose: Exposing global variables... (you can disable this by modifying the properties in `sails.config.globals`) | |
verbose: logger hook loaded successfully. |
View broken.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
├── async@0.9.0 | |
├─┬ bcrypt@0.8.0 | |
│ ├── bindings@1.0.0 | |
│ └── nan@1.3.0 | |
├─┬ chai@1.9.2 | |
│ ├── assertion-error@1.0.0 | |
│ └─┬ deep-eql@0.1.3 | |
│ └── type-detect@0.1.1 | |
├── chai-as-promised@4.1.1 | |
├── ejs@0.8.8 |
View enforceSsl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// author arcseldon@icloud.com | |
'use strict'; | |
module.exports = function (req, res, next) { | |
// we ARE deploying to Heroku. SSL termination happens at the load balancer, | |
// before encrypted traffic reaches your node app. It is possible to test | |
// whether https was used to make the request with req.headers['x-forwarded-proto'] === 'https'. | |
// See SOF answer by arcseldon: http://stackoverflow.com/a/22585754/1882064 | |
if ((req.headers['x-forwarded-proto'] !== 'https') && (process.env.NODE_ENV === 'production')) { | |
return res.redirect([ |
View gulpfile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
View .eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"plugins": ["react"], | |
"ecmaFeatures": { |
View ramda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') |
View ramdadocs.jpg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test |
OlderNewer