Skip to content

Instantly share code, notes, and snippets.

View Aupajo's full-sized avatar

Pete Nicholls Aupajo

  • Christchurch, New Zealand
View GitHub Profile
@Aupajo
Aupajo / gist:3387
Created July 31, 2008 02:02
Toggles hidden files in Finder on Mac OS X. Useful for finding those pesky .htaccess files.
#!/bin/bash
if [ `defaults read com.apple.finder AppleShowAllFiles` == 1 ]
then
echo "Hiding hidden files."
defaults write com.apple.finder AppleShowAllFiles -bool false
else
echo "Showing hidden files."
defaults write com.apple.finder AppleShowAllFiles -bool true
fi
@Aupajo
Aupajo / github-code-search.js
Created November 29, 2008 20:58 — forked from bastos/github-code-search.js
Different command.
// Based on apidock.org Ubiquity Search: http://gist.github.com/8132
CmdUtils.CreateCommand(
{
name: "github",
takes: {"function": noun_arb_text},
icon: "http://github.com/fluidicon.png",
homepage: "http://tiago.zusee.com",
author: {name: "Tiago Bastos", email: "comechao@gmail.com"},
license: "MPL,GPL",
description: "Search on Github Code Search",
@Aupajo
Aupajo / git ps1 and completion on leopard
Created February 8, 2009 01:27
git ps1 and completion on leopard
curl -o ~/.git-completion.bash http://github.com/git/git/raw/master/contrib/completion/git-completion.bash
echo "source ~/.git-completion.bash" >> ~/.profile
echo "export PS1='\u:\W\$(__git_ps1 \"\[\e[32m\][%s]\[\e[0m\]\")$ '" >> ~/.profile
source ~/.profile
@Aupajo
Aupajo / timeline.as
Created February 8, 2009 02:17
easy actionscript movieclip switching
/*
Paste the code into the timeline. Set up your library so each clip has a class, and:
switchClip(Menu);
switchClip(Film);
It also returns the new clip, so you can chain methods like this:
switchClip(Film).addEventListener(Event.ENTER_FRAME, function(event:Event) {
trace('The film is playing!');
@Aupajo
Aupajo / gist:61649
Created February 10, 2009 22:45 — forked from anonymous/gist:61647
Top used commands
history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr
83 nano
55 git
47 ssh
47 ghproxy
47 cd
36 ls
24 ping
19 sudo
@Aupajo
Aupajo / gist:61793
Created February 11, 2009 03:05
GistBot's first moments
GistBot joined the chat room.
[3:52pm] Aupajo: !gist anyone wanna see a cool gist trick?
[3:52pm] GistBot: http://gist.github.com/61788
[3:53pm] Aupajo: https://github.com/Aupajo/gistbot/tree/master
[3:53pm] rjbs: Bah. I want to push /all/ my branches to a remote.
[3:53pm] rjbs: Is there no trivial way?
[3:54pm] BonzoESC: Aupajo: that's nothing
[3:54pm] BonzoESC: http://gist.github.com/4280
[...]
[3:58pm] Aupajo: anything you private message to gistbot gets turned into a private gist too
@Aupajo
Aupajo / magic.markdown
Created February 12, 2009 04:13
A quick markdown test.

This is a header.

  1. This is the first list item.
  2. This is the second list item.

Here's some example code:

return shell_exec("echo $input | $markdown_script");
require 'sinatra'
require 'dm-core'
class Post do
include 'DataMapper'
property :title, String, :length => 255
property :content, Text
end
get '/' do
@posts = Post.all
erb :posts
@Aupajo
Aupajo / custom_before_header.rb
Created February 23, 2009 01:32
Custom Sinatra header
before do
response.header['X-Quote'] = 'Imagination, not intelligence, made us human.'
end
@Aupajo
Aupajo / sinatra_helpers.rb
Created March 2, 2009 03:21
Sweet Sinatra helpers
helpers do
def site_name
'Super Happy Fun Site'
end
# Shows the page title, throw this in your <title> tags
def page_title
(@heading + ' &mdash; ' if @heading).to_s + site_name
end