Skip to content

Instantly share code, notes, and snippets.

View PatrickHeneise's full-sized avatar
🏡
Working remote

Patrick Heneise PatrickHeneise

🏡
Working remote
View GitHub Profile
@PatrickHeneise
PatrickHeneise / gist:2132062
Created March 20, 2012 06:38
passport.js with flatiron.js, union and director
var flatiron = require('flatiron')
, connect = require('connect')
, path = require('path')
, fs = require('fs')
, plates = require('plates')
, director = require('director')
, util = require('util')
, keys = require('./auth_keys')
, passport = require('passport')
, TwitterStrategy = require('passport-twitter').Strategy
{
"debug": false,
"github": {
"user": "BcnJS",
"org": "BarcelonaJS",
"repos": {
"planning": "planning",
"speakers": "speakers",
"gitevent": "BarcelonaJS",
"jobs": "jobs"
@PatrickHeneise
PatrickHeneise / index.js
Created February 27, 2016 14:47
requirable index.js file to return an array of all .js and .json files within a directory
'use strict';
var fs = require('fs');
var contents = [];
var files = fs.readdirSync(__dirname);
files.reduce(function (error, key) {
var file = key.replace(/.json|.js/g, '');
if (file !== 'index') {
@PatrickHeneise
PatrickHeneise / pretty-couchdb-views.md
Last active March 2, 2016 15:23
Bootstrap/reset your CouchDB views with pretty JavaScript

I use this to destroy and create a fresh database for testing. Importing the views this way I can use my favourite editor and have prettify/beautify/linting/hinting on my map-reduce view functions instead of using the Futon editor.

Put all your view functions into:

  • data/[designDoc]-[viewName].js (like zdata users-index.js)
  • data/index.js (like zdata index.js)

Use something like 0-setup.js to import the views into your CouchDB.

Have fun.

@PatrickHeneise
PatrickHeneise / serverless.yml
Created June 20, 2018 12:36
Typeform & Infusionsoft Serverless Deployment
service: typeform
plugins:
- serverless-offline
provider:
name: aws
runtime: nodejs8.10
stage: dev
profile: typeform
@PatrickHeneise
PatrickHeneise / .staging.yaml
Last active August 31, 2018 11:50
Google Clouf Function Deployment
ES_HOST: 123.europe-west1.gcp.cloud.es.io
ES_PORT: '9243'
ES_AUTH: elastic:something
@PatrickHeneise
PatrickHeneise / cloudconfig.yaml
Last active August 31, 2018 11:57
cloud config
steps:
- name: gcr.io/cloud-builders/gcloud
id: decrypt
waitFor: ["-"]
args:
- kms
- decrypt
- --ciphertext-file=${_ENV}.yaml.enc
- --plaintext-file=${_ENV}.yaml
- --location=global
@PatrickHeneise
PatrickHeneise / upgrade.sh
Last active November 21, 2018 08:59
Update all packages in subfolders
#!/bin/bash
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
for i in * ; do
if [ -d "$i" ]; then
cd "$i"
printf '\n\n%s\n' "${PWD##*/}$(parse_git_branch):"
const a = [{ a: 'a' }, { a: 'b' }]
const b = ['1', '2']
const res = []
a.forEach(str => {
b.forEach(num => {
str.b = num
res.push(str)
})
})
Verifying my Blockstack ID is secured with the address 14Q9sFUCgWfBmWi5aWGogpX2C7ANEEj38q https://explorer.blockstack.org/address/14Q9sFUCgWfBmWi5aWGogpX2C7ANEEj38q