Skip to content

Instantly share code, notes, and snippets.

View xcambar's full-sized avatar

Xavier Cambar xcambar

View GitHub Profile
#install required packages
apt-get update
apt-get upgrade -y
apt-get install -y git curl build-essential libssl-dev libcurl4-openssl-dev nodejs
#install sqlite3 (optional)
apt-get install libsqlite3-dev sqlite3
#install postgres (optional)
sudo apt-get install postlibpq-dev
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/xav/code/karma-bro-proxyquireify/node_modules/proxyquireify/index.js":[function(require,module,exports){
'use strict';
function ProxyquireifyError(msg) {
this.name = 'ProxyquireifyError';
Error.captureStackTrace(this, ProxyquireifyError);
this.message = msg || 'An error occurred inside proxyquireify.';
}
function validateArguments(request, stubs) {
@xcambar
xcambar / grunt.site
Created October 1, 2014 08:41
NGinx configuration to proxy Grunt from a subdir
set $front_port "9000";
set $front_host "10.0.2.2";
location @proxy_to_front {
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Protocol $scheme;
rewrite ^/app(.*) $1 break;
@xcambar
xcambar / node_nvm.sh
Last active August 29, 2015 14:07
Install Node 0.10.x with NVM
#!/usr/bin/env sh
#
# You can change the version by passing the "VERSION" environment variable
# eg, env VERSION=0.10 sh node_nvm.sh
#
: ${VERSION:="stable"}
echo
@xcambar
xcambar / mocks.sh
Created October 18, 2014 13:41
Mocking in shell scripts
#!/usr/bin/env bash
shopt -s expand_aliases
curl_mock() {
local success
[ "$1" == "success" ] && success=0 || success=1
shift
if [ $success -eq 0 ]; then
@xcambar
xcambar / sub.sh
Created November 4, 2014 16:32
Subshell example
with_subshell()
(
local_var="I'm local"
)
with_subshell
echo "$local_var"
@xcambar
xcambar / error.js
Created December 19, 2014 12:33
Ember simple redirect to error
App.AuthenticatedRoute = Ember.Mixin.create({
beforeModel: function () {
var isUserConnected = false;
if (!isUserConnected) {
throw new Error('Fail');
}
}
});
App.IndexRoute = Ember.Route.extend(App.AuthenticatedRoute, {
@xcambar
xcambar / create.sh
Created February 16, 2015 17:40
Create a DigitalOcean droplet + Register it into /etc/hosts with Tugboat. Because IP addresses are hard.
NAME=droplet_name #Use your own
tugboat create $NAME
tugboat wait $NAME
DO_IP=`tugboat info $NAME | grep IP | cut -f 2 -d : | xargs`
echo "$DO_IP $NAME.droplet" | sudo tee -a /etc/hosts
@xcambar
xcambar / git_quick_squash.sh
Created February 17, 2015 09:49
A Shell script to make git squashing a bit more straightforward
# gqs <-> git quick squash
#
# Rebases from the branch passed in argument
# Squashes the commits on top of it
#
# example: gqs origin/master
#
function gqs () {
local branch=$1
git fetch > /dev/null
@xcambar
xcambar / circle.yml
Created July 29, 2015 14:35
Many Python versions in CircleCI
dependencies:
pre:
- ln -s ~/.pyenv/versions/3.3.2/bin/python3.3 $VIRTUAL_ENV/bin
- ln -s ~/.pyenv/versions/3.4.1/bin/python3.4 $VIRTUAL_ENV/bin