Skip to content

Instantly share code, notes, and snippets.

View marshallswain's full-sized avatar
😄

Marshall Thompson marshallswain

😄
View GitHub Profile
@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 / mb.js
Last active October 14, 2018 21:46
mb object property accessor, formatted
const mb = (...p) => o => p.reduce((a, c) => Object(a)[c], o)
@marshallswain
marshallswain / auth.js
Created May 17, 2018 16:16
Next.js Feathers auth trick
jwtAuth({ token }) {
if (!isClient) {
app().set('accessToken', token);
return this.verifyToken(token)
.then(payload => this.loadUser(payload.userId));
}
return app()
.authenticate({ strategy: 'jwt', accessToken: token })
.then(response => this.verifyToken(response.accessToken))
@marshallswain
marshallswain / feathers-hooks.json
Last active October 17, 2017 18:08
VS Code Feathers Snippets
{
"Feathers Hook": {
"prefix": ";hook;",
"body": [
"const errors = require('feathers-errors')",
"",
"module.exports = function () {",
" return function $1 (context) {",
" $2",
" }",
@marshallswain
marshallswain / readme.md
Last active October 9, 2017 13:44
Webpack configuration for CanJS

Using Webpack with CanJS

This is a good starting Webpack configuration, but will need to be adjusted to work well in production.

Instructions

  1. Create webpack.config.js in the root of your project. (Refer to the Webpack CLI docs to learn how to customize this))
  2. Install dependencies: npm install webpack webpack-dev-server can-stache-loader svg-inline-loader style-loader less-loader less --save-dev

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 / users.test.js
Created September 13, 2017 19:56
Simple user create test
describe('create', function () {
before(function () {
return utils.services.users.removeByEmail(app, 'test@test.com')
})
it('allows user signup', function (done) {
const newUser = {
email: 'test@test.com',
password: 'test'
}
@marshallswain
marshallswain / feathersjs-auth0.js
Created June 4, 2016 20:49 — forked from theevangelista/feathersjs-auth0.js
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() {
@marshallswain
marshallswain / client.js
Created August 16, 2017 17:29
feathers-authentication Authenticate a socket client at connection time
const feathers = require('feathers/client')
const io = require('socket.io-client')
const axios = require('axios')
const rest = require('feathers-rest/client')
const socketio = require('feathers-socketio/client')
const auth = require('feathers-authentication-client')
const hooks = require('feathers-hooks')
// TODO: make this port dynamic like the server tests
const host = 'http://localhost:3030'
@marshallswain
marshallswain / generate-block.sh
Last active July 18, 2017 15:35
Starting Bitcoin Core dev
curl --user 'equibit:equibit' -H "Content-Type: application/json" -d '{"method":"generate", "params": [1]}' 127.0.0.1:18332