Skip to content

Instantly share code, notes, and snippets.

@jmreidy
jmreidy / test_mocha.opts
Last active January 9, 2018 11:49
Unit test React Native with Mocha
--compilers js:./test/support/compiler
--require ./test/support/init
@archit
archit / circle.yml
Created June 23, 2015 17:24
CircleCI config for generating code coverage report in a NodeJS project
dependencies:
pre:
- npm install -g istanbul
general:
artifacts:
- ./coverage
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@jdx
jdx / boot.js
Last active March 16, 2023 18:08
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
@steveriggins
steveriggins / gist:6652508
Last active December 23, 2015 14:59
iOS 7 has a bug (or made a design decision which goes against the documentation) to set the cookie policy of NSURLConnections to whatever the user has set their cookie preferences to via Settings -> Safari. This simple method resets the cookie policy to accept always. Apple documentation for cookieAcceptPolicy: https://developer.apple.com/librar…
- (void)takeControlOfTheCookies
{
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self takeControlOfTheCookies];
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active June 13, 2024 10:59
A badass list of frontend development resources I collected over time.
@dezinezync
dezinezync / logentries.stream.js
Last active November 28, 2018 01:04
Streaming Express.logger's output to logentries
var logStream = {
write: function(message,encoding) {
log.info(message.replace('\n', ''));
}
};
//Application's configuration
app.configure(function() {
//Your base config methods
(function($) {
// Used by dateinput
$.expr = {':': {}};
// Used by bootstrap
$.support = {};
// Used by dateinput
$.fn.clone = function(){
var ret = $();
# autocomplete.py - Redis autocomplete example
# download female-names.txt from http://antirez.com/misc/female-names.txt
# Ruby original: http://gist.github.com/574044
# Requires http://github.com/andymccurdy/redis-py/
from redis import Redis
r = Redis()
KEY = 'compl'