Skip to content

Instantly share code, notes, and snippets.

View zakgrant's full-sized avatar
🎯
Focusing

Zak Grant zakgrant

🎯
Focusing
View GitHub Profile
@zakgrant
zakgrant / index.html
Last active December 20, 2015 19:28
Bike route through the Kells hills via:geojson.io
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;
font-size:11px;
@zakgrant
zakgrant / phrases
Last active December 20, 2015 04:59
You Cunt Quotes for the ucaas
Well aren't you being a cunt-a-saurus Rex today.
@zakgrant
zakgrant / multi-type-schema.json
Created July 1, 2013 11:15
This is how to represent an object that can have multiple types within a JSON Schema
{
"$schema": "http://json-schema.org/draft-03/schema#",
"type": [
{
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
},
{
"type": "string",
defaults write NSGlobalDomain NSUseLeopardWindowValues NO
defaults write com.apple.Safari NSUseLeopardWindowValues YES
@zakgrant
zakgrant / non_sys_row_count.sql
Created November 28, 2012 09:47
Postgres non system table row count
SELECT relname, n_tup_ins - n_tup_del as rowcount
FROM pg_stat_all_tables
WHERE relname NOT LIKE 'pg_%'
AND relname NOT LIKE 'sql_%';
@zakgrant
zakgrant / delete_all_picasa_albums.sh
Created November 2, 2012 09:18
Delete all albums in Picasa Web Account
#!/usr/bin/env ruby
require "picasa"
# delete all albums.
begin
client = Picasa::Client.new user_id: $USER_ID, password: $PASSWORD
albums = client.album.list.entries
albums.each do |album|
@zakgrant
zakgrant / delete_all_albums.rb
Created October 15, 2012 22:06
Delete all Picasa Web Albums for an Account
#!/usr/bin/env ruby
# using the picasa gem => https://github.com/morgoth/picasa
require "picasa"
# delete all albums for an account.
begin
client = Picasa::Client.new(:user_id => $INSERT_GOOGLE_USER_NAME_HERE, :password => $INSERT_PASSWORD_HERE)
client.album.list.entries.each do |album|
client.album.delete(album.id)
@zakgrant
zakgrant / override_associations
Created May 16, 2012 13:28
Override Associations [Example of cars current and previous owner]
class Car < ActiveRecord::Base
belongs_to :owner
belongs_to :previous_owner, class_name: "Owner"
def owner(new_owner)
self.previous_owner = owner
super
end
end
@zakgrant
zakgrant / gist:2465828
Created April 22, 2012 18:09
Installing rbenv and ruby-build
brew update
brew install rbenv
brew install ruby-build
gem install rbenv-rehash
gem install bundler
git clone -- [email protected]:carsomyr/rbenv-bundler ~/.rbenv/plugins/bundler
@zakgrant
zakgrant / erb2haml.rb
Created April 22, 2012 12:02
Script for converting ERB to HAML
#! /usr/bin/env ruby
require 'hpricot'
require 'ruby_parser'
require 'optparse'
class ToHaml
def initialize(path)
@path = path
end