Skip to content

Instantly share code, notes, and snippets.

View marshallswain's full-sized avatar
😄

Marshall Thompson marshallswain

😄
View GitHub Profile
@daffl
daffl / models.js
Created November 6, 2019 18:06
Feathers Schema proposal ideas
const { setSchema } = require('@feathersjs/schema');
class User {}
setSchema(User, {
id: {
type: Number
},
email: {
description: 'The user email',
@dcvezzani
dcvezzani / 20170603-Cordova-Running-an-ios-app-in-a-specifi.md
Last active September 14, 2017 04:28
Cordova: Running an ios app in a specific ios emulator

Cordova: Running an ios app in a specific ios emulator

You need two flags when specifying which target to emulate. Also, do not include the version number on the end.

Find out what emulator images are available. Again, take into account that the version number will not be included when specifying the target in the cordova call.

./platforms/ios/cordova/lib/list-emulator-images

iPhone-5, 10.3
@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');
@silvestreh
silvestreh / app-index.js
Last active August 21, 2019 17:19
Integrate Nuxt into Feathers
// src/index.js
/* eslint-disable no-console */
const logger = require('winston');
const app = require('./app');
const port = app.get('port');
process.on('unhandledRejection', (reason, p) => {
logger.error('Unhandled Rejection at: Promise ', p, reason);
@vlucas
vlucas / encryption.js
Last active April 2, 2024 14:26
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
<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) {
location.reload(true);
}
@kkkrist
kkkrist / app.js
Last active February 26, 2019 00:26
Rate limiting for FeathersJS HTTP (REST API) and Web Sockets connections (Express, Node.js)
'use strict'
const bodyParser = require('body-parser')
const compress = require('compression')
const configuration = require('feathers-configuration')
const cors = require('cors')
const favicon = require('serve-favicon')
const feathers = require('feathers')
const hooks = require('feathers-hooks')
const limiter = require('limiter').RateLimiter // Generic limiter used for authentication attempts inside web socket connection
@theevangelista
theevangelista / feathersjs-auth0.js
Last active March 7, 2017 06:19
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() {
@leoj3n
leoj3n / Bootstrap--The-Good-Parts.md
Last active April 12, 2017 15:03
Bootstrap: The Good Parts

Bootstrap is hard to customize and rather bulky; when you enclude the entire library on your page, rarely are you utilizing all of the parts. Luckily, with the help of StealJS, we can load just the needed parts within a DoneJS application ON DEMAND and NON-DESTRUCTIVELY. You know how difficult it can be if you've tried to accomplish this in the past with old versions of Bootstrap within a framework of your choice. Well, if you're willing to adopt DoneJS (or at least the module loader StealJS), you'll be off to the races with a lightweight app that loads just the bare minmium of needed CSS and JS.

This guide will be broken into parts:

  • Installing DoneJS
  • Generating a new DoneJS project
  • Installing Boostrap v4
  • Installing Tether
  • Generating a new DoneJS component
  • Editing the package.json
@justinbmeyer
justinbmeyer / crazycon.md
Last active November 23, 2015 20:12
crazy connection stuff

Using Session

Behavior

var isSession = require("is-session")

behavior("uses-session", function(base){
	
	return {