Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.
I've tried to make it as lean and unobtrusive as possible.
errors/AppError.js
| // NOTE: this adds a filename and line number to winston's output | |
| // Example output: 'info (routes/index.js:34) GET 200 /index' | |
| var winston = require('winston') | |
| var path = require('path') | |
| var PROJECT_ROOT = path.join(__dirname, '..') | |
| var logger = new winston.logger({ ... }) | |
| // this allows winston to handle output from express' morgan middleware |
I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.
So it might be really unintuitive at first but lambda functions have three states.
| /* | |
| * A sample program of KCM. | |
| * | |
| * $ gcc -lbcc kcm-sample.c | |
| * $ ./a.out 10000 | |
| */ | |
| #include <err.h> | |
| #include <errno.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> |
| #include <iostream> | |
| #include <chrono> | |
| #include <ctime> | |
| #include <cmath> | |
| class Timer | |
| { | |
| public: | |
| void start() | |
| { |
| package main | |
| import ( | |
| "fmt" | |
| "net" | |
| "os" | |
| "syscall" | |
| ) | |
| const ( |
| #ifndef __CONSUMERPRODUCERQUEUE_H__ | |
| #define __CONSUMERPRODUCERQUEUE_H__ | |
| #include <queue> | |
| #include <mutex> | |
| #include <condition_variable> | |
| /* | |
| * Some references in order | |
| * |
| # You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
| # This is how I upload my new Sol Trader builds (http://soltrader.net) | |
| # Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
| S3KEY="my aws key" | |
| S3SECRET="my aws secret" # pass these in | |
| function putS3 | |
| { | |
| path=$1 |
Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
Please comment & let me know if you have a fork / fixes you'd like to include.