Skip to content

Instantly share code, notes, and snippets.

View priithaamer's full-sized avatar

Priit Haamer priithaamer

View GitHub Profile
@priithaamer
priithaamer / useragent.js
Created July 15, 2011 21:07 — forked from terkel/jquery.ua.js
Node.js User-Agent parser
// Based on fantastic jQuery useragent parser plugin https://gist.github.com/373298
function parse(uaStr) {
var agent = {
platform: {},
browser: {},
engine: {}
};
var ua = uaStr,
p = agent.platform,
@priithaamer
priithaamer / gist:1034070
Created June 19, 2011 11:01
Capistrano task to ask confirmation before deploying to production
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to perform actions on production server(s)
Please confirm that all your intentions are kind and friendly
========================================================================
@priithaamer
priithaamer / showoff-style.css
Created May 28, 2011 09:59
My showoff style
body {
font-family: HelveticaNeue;
font-weight: bold;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
}
@priithaamer
priithaamer / config.ru
Created October 21, 2010 09:30
Gollum rackup script
#!/usr/bin/ruby
require 'rubygems'
require 'gollum/frontend/app'
system("which git") or raise "Looks like I can't find the git CLI in your path.\nYour path is: #{ENV['PATH']}"
gollum_path = '/Users/priit/Documents/Fraktal/Wiki'
disable :run
@priithaamer
priithaamer / post-update
Created September 23, 2010 08:56
Git post-receive file to update contents in another directory on the same server.
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
WORKDIR="/some/git/repo/workdir"
export GIT_DIR=$WORKDIR/.git
pushd $WORKDIR > /dev/null
@priithaamer
priithaamer / phone
Created August 19, 2010 07:45
Command line utility to send Prowl notifications to phone
#!/usr/bin/env ruby
require 'rubygems'
require 'yaml'
require 'prowl'
require 'readline'
config_file = File.join(ENV['HOME'], '.prowl')
if File.exist?(config_file)
@priithaamer
priithaamer / gist:456958
Created June 29, 2010 08:08
Capistrano tasks to show git diff and log between local and remote environments
namespace :git do
desc 'Shows a Git diff between the current version on server and latest on HEAD'
task :diff_pending do
local_sha = `git rev-parse --verify HEAD`
remote_sha = capture("cd #{current_path}; git rev-parse --verify HEAD")
puts `git diff #{remote_sha.strip} #{local_sha.strip}`
end
desc 'Shows a Git log between the current version on server and latest on HEAD'
task :log_pending do