Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View heijmerikx's full-sized avatar

Rutger Heijmerikx heijmerikx

View GitHub Profile
@schempy
schempy / stream-file-upload-s3-nodejs.js
Last active March 11, 2024 10:20
Streaming File Uploads To Amazon S3 With Node.js
var http = require('http');
var router = require('routes')();
var Busboy = require('busboy');
var AWS = require('aws-sdk');
var inspect = require('util').inspect;
var port = 5000;
// Define s3-upload-stream with S3 credentials.
var s3Stream = require('s3-upload-stream')(new AWS.S3({
accessKeyId: '',
@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@jkubacki
jkubacki / gist:e2dd904bd648b0bd4554
Created January 21, 2015 18:47
Mac uninstall elasticsearch
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@jcolemorrison
jcolemorrison / app.js
Created April 14, 2014 13:40
Building an Angular and Express App Part 1: app.js - J Cole Morrison
var express = require('express');
var path = require('path');
var favicon = require('static-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
@James1x0
James1x0 / momentjs.humanized.triplesplit.time.js
Created January 15, 2014 19:42
Get a humanized, "Morning", "Afternoon", "Evening" from moment.js **Great for user greetings!**
function getGreetingTime (m) {
var g = null; //return g
if(!m || !m.isValid()) { return; } //if we can't find a valid or filled moment, we return.
var split_afternoon = 12 //24hr time to split the afternoon
var split_evening = 17 //24hr time to split the evening
var currentHour = parseFloat(m.format("HH"));
if(currentHour >= split_afternoon && currentHour <= split_evening) {
@bMinaise
bMinaise / bs3-login-form.html
Created November 6, 2013 02:20
Bootstrap 3 - Login Form Example From: http://bootsnipp.com
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
@tbarbugli
tbarbugli / reset.sql
Created May 1, 2013 13:10
reset all sequences on a postgres db
SELECT 'SELECT SETVAL(' ||quote_literal(S.relname)|| ', MAX(' ||quote_ident(C.attname)|| ') ) FROM ' ||quote_ident(T.relname)|| ';'
FROM pg_class AS S, pg_depend AS D, pg_class AS T, pg_attribute AS C
WHERE S.relkind = 'S'
AND S.oid = D.objid
AND D.refobjid = T.oid
AND D.refobjid = C.attrelid
AND D.refobjsubid = C.attnum
ORDER BY S.relname;
@heijmerikx
heijmerikx / Capistrano-Deployment-Recipe.rb
Created October 16, 2012 08:54 — forked from mrrooijen/Capistrano-Deployment-Recipe.rb
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@jboner
jboner / latency.txt
Last active April 22, 2024 15:20
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->