Skip to content

Instantly share code, notes, and snippets.

Avatar

Colin Nederkoorn sud0n1m

View GitHub Profile
View gulpfile.babel.js
import gulp from 'gulp';
import plugins from 'gulp-load-plugins';
import browser from 'browser-sync';
import rimraf from 'rimraf';
import panini from 'panini';
import yargs from 'yargs';
import lazypipe from 'lazypipe';
import inky from 'inky';
import fs from 'fs';
import siphon from 'siphon-media-query';
@sud0n1m
sud0n1m / event.txt
Last active Jul 20, 2016
Code to merge in the customer object and event object formatted as valid JSON.
View event.txt
{
"event":
{{ event | replace: "=>", ":" }},
"customer":
{{ customer | replace: "=>", ":" }}
}
View lob_example.json
{
"description": "What a fancy postcard",
"to": {
"name": "{{ customer.first_name }} {{ customer.last_name }}",
"address_line1": "{{ customer.address_1 }}",
"address_line2": "{{ customer.address_2 }}",
"address_city": "{{ customer.city }}",
"address_state": "{{ customer.State }}",
"address_zip": "{{ customer.zip }}",
"address_country": "US"
View fast.com casper logging script
// 1. Add this file to a tests directory and name it netflix.js.
// 2. Create a docker container that mounts that directory
// docker run -it -d --name casper2 -v /mnt/user/tests:/tests rdpanek/casperjs bin/bash
// 3. Set up an hourly cron job by creating a new file
// #!/bin/bash
// docker exec casper2 casperjs /tests/netflix.js
// Then add a command to /etc/cron.hourly/speedtest to run this script in the container and chmod +x that file.
var casper = require('casper').create();
casper.options.waitTimeout = 120000;
@sud0n1m
sud0n1m / customer.io_upload.js
Created Nov 20, 2012 — forked from nicolasembleton/customer.io_upload.js
Import your customer data with custom parameters into customer.io
View customer.io_upload.js
//#!/usr/bin/env node
var http = require("http"),
fs = require("fs"),
sys = require('sys'),
exec = require('child_process').exec;
var ENDPOINT="https://app.customer.io/api/v1/customers/";
var SITEID="YOUR SITE ID";
var APIKEY="YOUR API KEY";
View identify.php
<?php if $_SESSION[user] ?>
<script type="text/javascript">
_cio.identify({
// Signed in user attributes
id: <?= $_SESSION[user][id] ?>, // Unique id for the currently signed in user in your application.
email:<?= $_SESSION[user][email] ?>, // Email of the currently signed in user.
created_at:<?= $_SESSION[user][created_at] ?>,
View Discourse Instructions
# From the Discourse-Chef directory
SERVER="yourdomain.com"
# Install Instructions
librarian-chef install
# enter your password once and never again
ssh-copy-id root@$SERVER
@sud0n1m
sud0n1m / Capfile
Last active Dec 13, 2015
A preliminary capistrano deploy script for discourse. To be used together with https://github.com/sud0n1m/discourse-chef
View Capfile
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'deploy/assets'
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
View bootstrap.sh
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p385.tar.gz
tar -xvzf ruby-1.9.3-p385.tar.gz
cd ruby-1.9.3-p385/
./configure --prefix=/usr/local
make
make install
View chef_solo_bootstrap.sh
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
tar -xvzf ruby-1.9.3-p327.tar.gz
cd ruby-1.9.3-p327/
./configure --prefix=/usr/local
make