Skip to content

Instantly share code, notes, and snippets.

View mikedamage's full-sized avatar

Mike Green mikedamage

View GitHub Profile
@mikedamage
mikedamage / snippet.txt
Created December 29, 2008 16:00
Basic LaTeX Article Template
\documentclass[11pt]{article}
\usepackage{graphicx} % needed for including graphics e.g. EPS, PS
\topmargin -1.5cm % read Lamport p.163
\oddsidemargin -0.04cm % read Lamport p.163
\evensidemargin -0.04cm % same as oddsidemargin but for left-hand pages
\textwidth 16.59cm
\textheight 21.94cm
%\pagestyle{empty} % Uncomment if don't want page numbers
\parskip 7.2pt % sets spacing between paragraphs
%\renewcommand{\baselinestretch}{1.5} % Uncomment for 1.5 spacing between lines
@mikedamage
mikedamage / hello.b
Created December 29, 2008 16:10
"Hello World" in Brainfuck
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
$result = mysql_query("SELECT * FROM table ORDER BY column DESC");
// I hard-code the column names so I can capitalize, add spaces, etc.
$fields = '"User ID","Name","Email","Registration Date"'."\n";
// Iterate through the rows of data
while ($row = mysql_fetch_assoc($result))
{
$fields .= '"'.$row['id'].'","'.$row['name'].'","'.$row['email'].'","'.$row['registration_date'].'"'."\n";
}
if (window.sidebar) {
window.sidebar.addPanel(title, url,"");
}
require 'optparse'
app = Hash.new
options = OptionParser.new do |opts|
opts.on("-o", "--option [ARG]", "Option description") do |opt|
app['option'] = opt
end
end
@mikedamage
mikedamage / desktop_resolution.scpt
Created January 16, 2009 04:09
Applescript: get desktop resolution
tell application "Finder"
set _b to bounds of window of desktop
set _w to item 3 of _b
set _h to item 4 of _b
end tell
# This is how it would look using the Ruby Regexp class
# Only match one-line comments
@single_line_comments_pattern = Regexp.new(/\/\*.*?\*\//)
# Match single and multi-line comments
@all_comments_pattern = Regexp.new(/\/\*.*?\*\//m)
/* ColorSchemer Search */
CmdUtils.CreateCommand({
name: "color-schemer",
icon: "http://www.colorschemer.com/favicon.ico",
preview: "Search colorschemer.com for color schemes",
author: { name: "Mike Green", email: "mike.is.green@gmail.com" },
license: "GNU GPL",
takes: {"input": noun_arb_text },
execute: function(input) {
Utils.openUrlInBrowser("http://www.colorschemer.com/schemes/search.php?s="+encodeURIComponent(input.text));
/* BTJunkie Torrent Search */
CmdUtils.CreateCommand({
name: "btjunkie",
icon: "http://btjunkie.org/favicon.ico",
preview: "Search btjunkie.org for torrents",
author: { name: "Mike Green", email: "mike@fifthroomcreative.com" },
license: "GPL",
takes: {"input": noun_arb_text},
execute: function(input) {
Utils.openUrlInBrowser("http://btjunkie.org/search?q="+encodeURIComponent(input.text));
/* Lifehacker Blog Search */
CmdUtils.CreateCommand({
name: "lifehacker",
icon: "http://lifehacker.com/favicon.ico",
preview: "Search Lifehacker blog articles",
author: { name: "Mike Green", email: "mike.is.green@gmail.com" },
license: "GNU GPL",
takes: {"input": noun_arb_text},
execute: function(input) {
Utils.openUrlInBrowser("http://lifehacker.com/search/"+encodeURIComponent(input.text));