Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am caspyin on github.
  • I am caspyin (https://keybase.io/caspyin) on keybase.
  • I have a public key whose fingerprint is 5708 1010 8836 C17B 7159 B919 F9DC 5371 F98B C2C9

To claim this, I am signing this object:

@btoone
btoone / ng-demo.html
Created March 28, 2014 21:49
Demo of Angular all in a single file.
<!DOCTYPE html>
<html lang="en">
<head>
<title>AngularJS Routing example</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding-top: 10px;
background-color: #F5F5F5;
}
<ul>
<% @images.each do |image| %>
<li><%= link_to product_image_url(image) %></li>
<% end %>
</ul>
@btoone
btoone / bootstrap.sh
Last active December 15, 2015 07:49
Bootstrap ubuntu vm. Installs build tools for rails apps, chef (via omnibus), the specified ruby version and a couple of gems.
#!/usr/bin/env bash
# TODO:
#
# * Add support for sudo
# * Add checks for each piece of software to determine if it is already installed
# instead of relying on a single global check of the log file.
#
log_dir=$HOME
@btoone
btoone / countdown.rb
Last active December 11, 2015 07:49
# Inspired by https://github.com/7hunderbird
# Execute via `curl -fs https://gist.github.com/raw/4569096/373e78aa18b438e74f04a782dd5ca7416b2cb50a/countdown.rb | ruby`
# in the terminal
require 'Date'
today = Date.today
deadline = Date.new(2013, 03, 04)
num_of_days = (deadline - today).to_i
@btoone
btoone / compile_image_magick.txt
Created August 21, 2012 16:58 — forked from rgo/compile_image_magick.txt
Compile latest ImageMagick version (useful for old distros)
## From http://johannes.jarolim.com/blog/2011/11/21/extreme-slow-imagemagick-on-vps-with-ubuntu/
#
# Execute as root
apt-get update
apt-get install build-essential
apt-get build-dep imagemagick
cd /usr/local/src
VERSION = "6.7.9-0"
@btoone
btoone / unicorn_example.sh
Created August 20, 2012 19:50 — forked from tualatrix/unicorn_example.sh
An example of unicorn init script for Ubuntu
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
@btoone
btoone / nginx_rails_3_1
Created August 19, 2012 00:59 — forked from shapeshed/nginx_rails_3_1
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
@btoone
btoone / gist:2289251
Created April 3, 2012 04:09
Excel VLOOKUP usage
=VLOOKUP($F2,Sheet1!$D$2:$BL$1206,N1+1)
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
lookup _value: The value you want to find in the first column of the table_array.
table_array: This is the table of data that VLOOKUP searches to find the information you are after.
The table_array must contain at least two columns of data. The first column contains the lookup_values.
col_index_num: The number of the column in the table_array that contains the data you want returned.
@btoone
btoone / gist:2289249
Created April 3, 2012 04:09
Regex to parse apache error log
# Textmate regex that removes the end of apache error log
, referer:.+$