Skip to content

Instantly share code, notes, and snippets.

@kenfehling
kenfehling / Dockerfile
Last active March 23, 2019 12:02
Docker: Ubuntu 16.04 with Node 6.10.2, Selenium Standalone, Chrome Headless
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
apt-transport-https \
openjdk-8-jre-headless \
curl \
xz-utils \
unzip \
bzip2 \
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@nikmartin
nikmartin / A: Secure Sessions Howto
Last active April 28, 2024 05:17
Secure sessions with Node.js, Express.js, and NginX as an SSL Proxy
Secure sessions are easy, but not very well documented.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT]
Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now.
@andelf
andelf / sighup.go
Created June 29, 2013 05:25
golang process SIGHUP, HUP signal to reload configuration
// program
package main
import "os/signal"
import "os"
import "fmt"
import "syscall"
import "time"
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@toshirot
toshirot / websocket-protocol-fallback.js
Created December 4, 2011 00:09 — forked from nicokaiser/websocket-protocol-fallback.js
WebSocket library fallback for old protocol clients
// This code is fallback for https://github.com/Worlize/WebSocket-Node
// add the broadcast to https://gist.github.com/1219165
// 2011.11.30 tato@http://www.facebook.com/javascripting
// Example of how to fallback to alternative websocket library for old protocol clients
// see https://gist.github.com/1148686
var http = require('http'),
WebSocketRequest = require('websocket').request,
@lsm
lsm / background_demo.js
Created August 5, 2011 11:07 — forked from kosso/background_demo.js
Background Service notification for Titanium
/* Kosso : March 12th 2011
This the only way I managed to do this without the app crashing on resume.
Done slightly differently to the KS example, since they unregister the service and
do not use a setInterval timer.
*/
//############ in app.js :
// test for iOS 4+
@TooTallNate
TooTallNate / starttls.js
Created March 1, 2011 01:40
Upgrade a regular `net.Stream` connection to a secure `tls` connection.
// Target API:
//
// var s = require('net').createStream(25, 'smtp.example.com');
// s.on('connect', function() {
// require('starttls')(s, options, function() {
// if (!s.authorized) {
// s.destroy();
// return;
// }
//