Skip to content

Instantly share code, notes, and snippets.

Always deliver more than expected.

Luiz Freneda lfreneda

Always deliver more than expected.
View GitHub Profile
dmfay / collapse.js
Last active Sep 6, 2017
Collapse JOIN query result sets into a hierarchical object graph
View collapse.js
'use strict';
* Collapses tabular result sets into a (hierarchical) object graph based on
* column nomenclature. Given a query that selects parent and child columns as
* parent__id, parent__val, children__id, children__val, this will return an
* array of objects in the form
* {id: 1, val: 'parent val', children: [{id: 11, val: 'child val'}]}
leommoore /
Last active Apr 23, 2018
Ionic Publish Android App

#Ionic Publish Android App

This is the process to publish an ionic android app.

  1. Make sure you set/increment the version number in config.xml ie 0.0.3.

  2. Make sure the android platform has been added

neotreat / http-security-headers-lambda-cloudfront.js
Last active Aug 28, 2018
Add HTTP Security Headers to Cloudfront with Lambda@Edge.
View http-security-headers-lambda-cloudfront.js
'use strict';
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
// Add security headers
const securityHeaders = [
ippeiukai / cron.conf
Last active Apr 30, 2019
Running cron in AWS ElasticBeanstalk web tier.
View cron.conf
mode: "000777"
owner: 'ec2-user'
group: 'ec2-user'
content: |
30 02 * * * sudo /usr/sbin/execute-in-eb-node-app 'node bin/is-eb-master.js' && sudo /usr/sbin/execute-in-eb-node-app 'npm run daily-maintenance'
encoding: plain
mplatts / 0firebase_functions_cheatsheet.js
Last active Feb 7, 2020
Firebase functions cheatsheet
View 0firebase_functions_cheatsheet.js
// Core
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const db = admin.database();
uid: uid,
displayName: displayName,
photoURL: photoURL
louischatriot / nodejs-app.conf
Created Aug 18, 2012
Upstart script to launch a nodejs application as a service
View nodejs-app.conf
description "Upstart script to run a nodejs app as a service"
author "Louis Chatriot"
env NODE_BIN=/usr/local/bin/node
env APP_DIR=/path/to/app/dir
env SCRIPT_FILE="scriptfile.js" # Entry point for the nodejs app
env LOG_FILE=/path/to/logfile.log
env RUN_AS="anyuser" # Upstart can only be run nicely as root, need to drop privileges
env SERVER_ENV="anything" # Usual apps can be run in different environments (development, test, production ...)
# I typically use the environment variable NODE_ENV (see below)
mooniker /
Last active Aug 16, 2020 — forked from facultymatt/
Roles and permissions system for Nodejs

ACL / Roles + Permissions

Virgen-ACL (virgen-acl)

  • "Simple in-memory ACL for node.js apps. Supports arbitrary roles and resources, including role/resource detection using a simple interface. Additionally supports custom assertions for more complex rules."
  • Comments: "Simple and elegant, create your own checks. No middleware?"

Node ACL (acl) BuildStatusDependency StatusdevDependency Status


JavaScript Static Analysis Tools

Most people are familiar with these three tools:

  1. [JSHint][1]
  2. [JSLint][2]
  3. [Google Closure Linter][3]

The first one is more popular among developers because it is style-agnostic. The other two enforce rules of [Crockford Style][4] and [Google Code Style][5] respectively.

aemonge / prepare-commit-msg
Last active Feb 12, 2021
Angular Commit Message Conventions git hook, so you got your commit prepared to with the messages they expect ;)
View prepare-commit-msg
firstLine=`head -2 $1 | tail -1`
if [[ $firstLine == \#* ]]; then # Testing that the file starts with a comment, not yet a real commit ;)
echo '<type>(<component>): <subject>' > .prepare-commit-msg-temp
echo '' >> .prepare-commit-msg-temp
echo '<body>' >> .prepare-commit-msg-temp
echo '' >> .prepare-commit-msg-temp
echo '# types: feat, fix, docs, style, refactor, test, chore(mantean)' >> .prepare-commit-msg-temp
raineorshine /
Last active Mar 27, 2021
How to set up user authentication for a Chrome Extension using the Chrome Identity API

How to set up user authentication for a Chrome Extension using the Chrome Identity API

  1. Create a private key file, from which you can create the manifest key and Application ID, as detailed here:
  2. Add the manifest key to "key" in manifest.json
  3. Create a new project in Google Developer Console
  4. Go to "APIs & auth > Credentials" and create new client id for a Chrome Application using the Application ID generated in step 3.
  5. Copy the Client ID to oauth2.client_id in the manifest.json