Skip to content

Instantly share code, notes, and snippets.

View aidanbon's full-sized avatar

Francis Au-Yeung aidanbon

View GitHub Profile
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@staltz
staltz / introrx.md
Last active July 26, 2024 04:24
The introduction to Reactive Programming you've been missing
@dirkmc
dirkmc / interceptor.js
Last active January 20, 2016 17:01
Intercept requests from Amazon ELB and proxy them to a back end service depending on the IP indicated by the PROXY protocol
// Config looks like this:
/*
proxy: {
port: 5000,
// Indicates if there is a PROXY protocol enabled Load Balancer
// between us and the client
useProxyProtocol: true,
status: {
path: '/status.json',
// How many times can a host fail to respond before it is
@ericelliott
ericelliott / essential-javascript-links.md
Last active July 18, 2024 15:03
Essential JavaScript Links
@datchley
datchley / app.js
Last active September 20, 2022 01:22
"Getting Functional with Javascript" Blog post source files
/**
* Primary application logic for our Functional Programming blog example
* See related blog series at: http://www.datchley.name/tag/functional-programming/
* Version: 2.0
*/
// A simple, resuable comparison for '>='
function greaterThanOrEqual(a, b) {
return a >= b
}
@realadeel
realadeel / dash_lambda_food.js
Last active April 2, 2018 13:48
Pressing an Amazon AWS IoT Button to Find the Rright Restaurant - Node.js on AWS Lambda
var AWS = require('aws-sdk');
var sns = new AWS.SNS();
var GoogleMaps = require('googlemaps');
var GooglePlaces = require('node-googleplaces');
var weather = require('openweather-apis');
var stripe = require('stripe')(STRIPE_SECRET_KEY);
var googleConfig = { key: GOOGLE_API_KEY };
var maps = new GoogleMaps(googleConfig);
var places = new GooglePlaces(googleConfig.key);
var direction_params = {
@lobster1234
lobster1234 / serverless_framework_java_maven.md
Last active January 23, 2024 21:18
Tutorial for running the templated maven-java serverless project using the serverless framework.

Working with Serverless and Java - Part 1

In this tutorial, we will create and deploy a java-maven based serverless service using the serverless project (https://serverless.com/). In this part we will not modify any code, or even look at the generated code. We will focus on the deployment and the command line interface provided by serverless. Serverless is a node.js based framework that makes creating, deploying, and managing serverless functions a breeze. We will use AWS as our FaaS (Function-as-a-Service) provider.

Pre-requisites

Here is what the setup on my Mac looks like (Sierra)

  • brew (1.1.10) - you will need this if you do not have node/npm installed already.
  • node (v7.6.0)
  • npm (4.1.2)
  • Apache Maven (3.2.5)