Skip to content

Instantly share code, notes, and snippets.


  • New York, NY
Block or report user

Report or block afuchs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
afuchs /
Created Mar 23, 2016 — forked from iros/
Documenting your REST API


<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

View winston-stacktrace.js
var logger = require('winston');
// override winston.logger.log to add stacktrace along errors included
// 4 ways to include some errors in a log:
// - logger.warn('message', myError)
// - logger.warn('message', [myError1, myError2])
// - logger.warn('message', { error: myError })
// - logger.warn('message', { errors: [myError1, myError2] })
(function(logger) {
var _log = logger.log;
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone
cd node
sudo make install
# install the Node package manager for later use
View aviaryCustomSave.js
var editor = new Aviary.Feather({
// config
onSaveButtonClicked: function() {
// 1. start custom spinner and disable editor
editor.getImageData(function(data) { // `data` contains a base64 encoding of the image
// 2. POST `data` to your own server
// 3. stop custom spinner and enable or close the editor
return false; // prevents editor from following defautl save behavior
View uploadPhotoToS3.js
var AWS = require('aws-sdk');
var fs = require('fs');
var uuid = require('node-uuid');
var AWS_KEY_ID = '';
var AWS_ACCESS_KEY = '';
accessKeyId: AWS_KEY_ID,
View express-ssl.js
// 1. Generate SSL cert
// > openssl genrsa -out privatekey.pem 1024
// > openssl req -new -key privatekey.pem -out certrequest.csr
// > openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
// 2. Set up your express server
var https = require('https');
var fs = require('fs');
var express = require('express');
var app = express();
View loadScript.js
function loadScript(src, callback) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
if (callback) {
script.onreadystatechange = script.onload = function() {
View jsbin.Iribaqa.html
<!DOCTYPE html>
<meta charset=utf-8 />
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src="//"></script>
View gist:4254088
Content-Disposition: form-data; name="version"
Content-Disposition: form-data; name="calltype"
Content-Disposition: form-data; name="backgroundcolor"
You can’t perform that action at this time.