Skip to content

Instantly share code, notes, and snippets.

View vandorjw's full-sized avatar

Joost van Dorp vandorjw

View GitHub Profile
@vandorjw
vandorjw / node_version_manager.txt
Created June 22, 2016 03:40
Node version management, without effecting system files.
The way I like to do it is:
1. Unpack the official pre-built binaries into ~/.node (.e.g https://nodejs.org/dist/v0.12.7/node-v0 … x64.tar.gz would be unpacked in ~/.node/node-v0.12.7-linux-x64
2. Add a symlink called current to your wanted node version (e.g. ln -s ~/.node/node-v0.12.7-linux-x64 ~/.node/current)
3. Add ~/.node/current/bin to your path (e.g echo export PATH=$HOME/.node/current/bin:$PATH >> ~/.bashrc)
This way you can just type npm install whatever and it's installed into your local npm version that you have symlinked under ~/.node/current.
If you want to change the version you're using, just point the symlink somewhere else.
Recorded from: https://bbs.archlinux.org/viewtopic.php?pid=1556844#p1556844
// oops, this would throw an error!
if (DEBUG) {
console.log( "Debugging is starting" );
}
// this is a safe existence check
if (typeof DEBUG !== "undefined") {
console.log( "Debugging is starting" );
}
@vandorjw
vandorjw / is_null.js
Created March 26, 2016 19:06
Javascript - Check if variable is null
/* * *
* takes any object as input and checks whether it's value is null.
* null is the only primitive value that is 'falsy' but also returns
* "object" from the typeof check.
*/
function is_null(obj) {
return (!obj && typeof obj === "object");
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
@vandorjw
vandorjw / sync.sh
Last active January 22, 2016 23:59
#!/bin/sh
# -- ********************************************************************************
# -- Description: Monitoring and sync script for identical remote folders
# -- Version: 0.1
# -- Notes: Ony the folder on the server on which this script resides incurs
# changes. Therefor, we only sync 1 way.
# -- Requires: incron: sudo apt-cache search incron
# using incrontab -e add the following:
# /path/to/folder IN_CLOSE_WRITE /path/to/this/scrip.sh $@/$#
@vandorjw
vandorjw / notes.txt
Created August 31, 2015 13:10
OS X Niceties - bashrc and other things
##
# .bashrc
##
export PGDATA='/usr/local/var/postgres'
export PGHOST=localhost
alias start-pg='pg_ctl -l $PGDATA/server.log start'
alias stop-pg='pg_ctl stop -m fast'
alias show-pg-status='pg_ctl status'
alias restart-pg='pg_ctl reload'
@vandorjw
vandorjw / jquery.formset.js
Created August 17, 2015 17:28
jquery.formset.js
;(function($) {
$.fn.formset = function(opts)
{
var options = $.extend({}, $.fn.formset.defaults, opts),
flatExtraClasses = options.extraClasses.join(' '),
totalForms = $('#id_' + options.prefix + '-TOTAL_FORMS'),
maxForms = $('#id_' + options.prefix + '-MAX_NUM_FORMS'),
childElementSelector = 'input,select,textarea,label,div',
$$ = $(this),
@vandorjw
vandorjw / jenikns_ci_on_ubuntu.md
Last active March 31, 2016 10:16 — forked from ostinelli/jenkins_ci_on_ubuntu.md
Setup Jenkins CI on Ubuntu.

Jenkins CI

Instructions on how to setup a secured Jenkins CI.

Install Jenkins

$ wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list$ .d/jenkins.list'
$ sudo apt-get update
$ sudo apt-get install jenkins
@vandorjw
vandorjw / README
Last active August 29, 2015 14:18
Deploy TeamCity CentOS7
#rough tutorial to deploy Teamcity 9 to CentOS
Maybe in the future I will create an RPM package to ease this process
##initial steps
0. install java-headless, postgresql, etc.
1. Create a system-user for teamcity
<html>
<head>
<meta charset="UTF-8">
<title>Refactored TapeDeck</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>