Skip to content

Instantly share code, notes, and snippets.

@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@lukemorton
lukemorton / syncInterval.js
Created December 8, 2011 10:55
Syncronous (safe) setInterval()
// Syncronous setInterval
// Usage:
// var interval = new SyncInterval(function () {
// console.log('bob');
// }, 500);
// interval.stop();
// Written by Luke Morton, Richard Willis
function SyncInterval(fn, wait, scope) {
var t = this;
wait = wait || 1000;
@Overbryd
Overbryd / nginx.conf
Created March 27, 2012 22:22
Nginx configuration for a CouchDB reverse proxy, also very useful for hosting CouchApps
worker_processes 4;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
@nateware
nateware / haproxy.conf
Created October 31, 2012 15:36
HAProxy sample config for EC2
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#
@senko
senko / create-new-lxc.sh
Created March 1, 2013 13:00
Set up a new LXC virtual machine
#!/bin/bash
#
# Initialize new virtual server using LXC and set up networking and HTTP proxy
#
# Written by: Deni Bertovic <deni.bertovic@dobarkod.hr>
#
# Released into Public Domain. You may use, modify and distribute it as you
# see fit.
#
# This script will:
@simonw
simonw / gist:7000493
Created October 15, 2013 23:53
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, obj):
if isinstance(obj, datetime.datetime):
return {
"_type": "datetime",
"value": obj.strftime("%s %s" % (
@badsyntax
badsyntax / .bashrc
Last active July 14, 2016 03:50
My new bash PS1 prompt (on osx)
alias ls='ls -G'
source /usr/share/git-core/git-prompt.sh
source /usr/share/git-core/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
GIT_PS1_SHOWUNTRACKEDFILES=true
PS1="\n\[\e[01;34m\]┌─(\[\e[01;35m\]\u@${HOSTNAME%%.*}\[\e[01;34m\])"'$(__git_ps1 "──(\[\e[01;31m\]%s\[\e[01;34m\])")'"\[\e[01;34m\]\n\[\e[01;34m\]└─(\[\e[01;32m\]\w\[\e[01;34m\])──(\[\e[01;32m\]$ \[\e[01;37m\]"
@badsyntax
badsyntax / example.js
Created March 28, 2014 11:34
Atom editor view (space-pen) without using CoffeeScript. NodeJs util.inherits is not compatible with CofeeScripts __extends. This is most frustrating. For now, we have to use the CS version.
var View = require('atom').View;
/** CofeeScript's version of inheritance */
var __hasProp = {}.hasOwnProperty;
var __extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) child[key] = parent[key];
}
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
@boodle
boodle / Making Apple Developer certificates on Linux.md
Last active May 5, 2024 09:07
Making Apple Developer certificates on Linux
  1. Create a new directory;
mkdir Apple\ Enterprise
cd Apple\ Enterprise
  1. Generate a certificate signing request
openssl req -nodes -newkey rsa:2048 -keyout ios_enterprise.key -out CertificateSigningRequest.certSigningRequest