Skip to content

Instantly share code, notes, and snippets.

@williscool
williscool / testapp.js
Created April 6, 2011 17:38
Testing out a vhost setup
// Expose modules in ./support for demo purposes
/**
* Module dependencies.
*/
var express = require('express');
// Edit /etc/vhosts
$graph = {a: [:b, :c], b: [:d, :e], c: [:f, :g]}
def dfs_nr(node)
queue = [node]
seen = {}
while queue.size > 0
node = queue.pop
puts node
seen[node] = true
if $graph[node]
@williscool
williscool / .bashrc
Last active April 27, 2018 01:20
my general bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# enable forward search
# http://ruslanspivak.com/2010/11/25/bash-history-incremental-search-forward/
# https://bugs.launchpad.net/ubuntu/+source/bash/+bug/80635/comments/12
stty -ixon
@williscool
williscool / useful_commands.md
Last active October 30, 2023 11:31
Commands that I've found to be useful. Mostly general command line, bash, and rails stuff

Useful commands:

TODO: rearrange this to bottom = oldest and top = newst (2-27-2020) below dashed line

fix tmux resurrect

ln -f -s $(/bin/ls -t tmux_resurrect_*.txt | head -n 1) last

tmux useful comands

@williscool
williscool / .gitconfig
Last active January 20, 2021 07:29
Standard Global gitconfig
[user]
name = William <REDACTED>
email = <REDACTED>
[color]
ui = true
branch = true
diff = true
status = true
log = true
[alias]
@williscool
williscool / p4merge
Created August 24, 2012 20:18 — forked from henrik242/p4merge
Helper script for p4merge and Git on MacOSX
#!/bin/bash
for arg; do [[ $arg = /* ]] || arg=$PWD/$arg; absargs+=("$arg"); done;
/Applications/p4merge.app/Contents/Resources/launchp4merge "${absargs[@]}"
@williscool
williscool / post-commit
Created January 26, 2013 20:43
Git lab references post commit hook
#!/bin/sh
PRIVATE_TOKEN="YOU_SECRET_TOKEN"
GITLAB_URL="http://gitlab.example.com/"
URL=`git config --get remote.origin.url`
PROJECT=`basename ${URL} .git | cut -d':' -f2`
COMMIT_MSG="git log -1 HEAD"
COMMIT_HASH_MSG=`git log -1 HEAD | head -1`
@williscool
williscool / some_mailer.rb
Last active December 16, 2015 20:29
Using a rails helper in a mailer or other class
class SomeMailer
class Helper
include ActionView::Helpers # rails standard helpers
include HelpfulMethodsHelper # for some function i_wrote
end
def helper
@@h ||= Helper.new
end
@williscool
williscool / active_hack.rb
Created May 8, 2013 16:58
hack of activesupport dependencies when it won't load the file from the correct path /Users/<user_name>/.rvm/gems/jruby-1.7.3@<your_gemset>/gems/activesupport-3.2.13/lib/active_support/dependencies.rb
# fucking shit activesupport or rvm or whoever's fault it is
if file.include?('active_support/krypt')
puts ''
puts "changing include of file #{file} due to wrong path"
file.gsub!("/Users/#{user_name}/.rvm/gems/jruby-1.7.3/gems/activesupport-3.2.13/lib/active_support/",'')
puts "path changed to: #{file}"
puts ''
end