Skip to content

Instantly share code, notes, and snippets.

View mariusbutuc's full-sized avatar
🌏

Marius Butuc mariusbutuc

🌏
  • Toronto, ON
  • 00:40 (UTC -04:00)
View GitHub Profile
@mariusbutuc
mariusbutuc / events.js
Created February 6, 2013 16:54
How Marius understood Node's single threaded asynchronous-ness & events
var events = require('events');
var eventEmitter = new events.EventEmitter()
function mainLoop() {
console.log('starting application');
eventEmitter.emit('AppStart');
console.log('Running App');
eventEmitter.emit('AppRun');
@mariusbutuc
mariusbutuc / chef_solo_bootstrap.sh
Last active December 14, 2015 05:58 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
# Apt-install various things necessary for Ruby etc.,
# and remove optional things to trim down the machine.
apt-get -y update
apt-get -y upgrade
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
apt-get -y install vim
apt-get -y install git-core
@mariusbutuc
mariusbutuc / deploy.rb
Created February 28, 2013 20:32
`deploy:setup` is successful, yet `deploy:cold` / `deploy:check` fail
require 'bundler/capistrano'
default_run_options[:pty] = true
set :application, 'example'
# repo
set :scm, :git
set :repository, "[email protected]:mariusbutuc/#{application}.git"
set :branch, 'master'
# deploy
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <[email protected]>
# Copyright:: 2007-2010 The Authors

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@mariusbutuc
mariusbutuc / output.sh
Created March 10, 2013 02:38
Chef Solo + Berkshelf + Vagrant » Install nginx from source
$ vagrant up
[default] Importing base box 'precise64bootstrap'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2201.
[default] Forwarding ports...
[default] -- 22 => 2201 (adapter 1)
[Berkshelf] installing cookbooks...
[Berkshelf] Using nginx (1.4.0)
[Berkshelf] Using bluepill (2.2.0)
@mariusbutuc
mariusbutuc / mysql_grant_user.output
Created March 10, 2013 22:42
The database password is now filtered by Chef both in the console and in the log on disk. – http://vialstudios.com/guide-authoring-cookbooks.html#creating_a_mysql_user_with_the_database_cookbook
[2013-03-10T22:37:35+00:00] INFO: mysql_database_user[scafandru_app]: granting access with statement [GRANT all ON `scafandru_dev`.* TO `scafandru_app`@`localhost` IDENTIFIED BY [FILTERED]]
@mariusbutuc
mariusbutuc / private_pub.rb
Created April 28, 2013 16:36
Private_pub binding faye unsubscribe
# Run with: rackup private_pub.ru -s thin -E production
require "bundler/setup"
require "yaml"
require "faye"
require "private_pub"
require "active_support/core_ext"
Faye::WebSocket.load_adapter('thin')
PrivatePub.load_config(File.expand_path("../config/private_pub.yml", __FILE__), ENV["RAILS_ENV"] || "development")
@mariusbutuc
mariusbutuc / pusher_connections.js
Last active August 29, 2015 14:01
Pusher Stats: focus on open connections data
/*
* Goal: see the peaks in Pusher connection counts
*
* Data: https://app.pusher.com/stats
* Example: http://i.imgur.com/ok517vf.png
*
*/
// Make graphs full-width
$('#sidebar-nav, .navbar, #IntercomDefaultWidget').css('display', 'none');
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://www.marketo.com/mktows/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.marketo.com/mktows/">
<SOAP-ENV:Header>
<ns1:AuthenticationHeader>
<mktowsUserId>...</mktowsUserId>
<requestSignature>...</requestSignature>
<requestTimestamp>2014-06-12T13:26:58-04:00</requestTimestamp>
</ns1:AuthenticationHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>