Skip to content

Instantly share code, notes, and snippets.

@fixlr
fixlr / ArchiveMail.scpt
Created April 28, 2011 14:28
AppleScript that I use to make Mail.app suck less.
tell application "Mail"
set theSelectedMessages to selection
repeat with theMessage in theSelectedMessages
set theMailbox to "All Mail"
tell application "Mail"
move the theMessage to mailbox theMailbox
end tell
end repeat
end tell
@fixlr
fixlr / media_queries.css
Created April 28, 2011 18:03
Example of a basic CSS media query.
@media all and (max-device-width: 480px) {
//
// Define new CSS rules here for screens
// that are less than 480px wide.
//
// These rules will need to OVERRIDE the global
// styles that you have previously declared.
//
<!-- First, let's define a CSS class to hide things. -->
<style type="text/css">
.hidden { display: none; }
</style>
<!-- Now let's see what happens when we execute some
javascript within the hidden element. -->
<div class="hidden">
@fixlr
fixlr / gist:959777
Created May 6, 2011 21:02
ProcessGBSBookInfo() fix
<script>
// Function to process GBS info and update the dom.
function ProcessGBSBookInfo(booksInfo) {
for (isbn in booksInfo) {
var url_elem = document.getElementById(isbn);
var pic_elem = document.getElementById("google_book");
var gbs_elem = document.getElementById("GBSDiv");
var bookInfo = booksInfo[isbn];
if (bookInfo) {
gbs_elem.innerHTML="<fieldset style='width:100px'><div align=center></div></fieldset>";
@fixlr
fixlr / Custom Searches.md
Created May 12, 2011 16:47
Some of my current Alfred shortcuts
@fixlr
fixlr / PickColor.scpt
Created May 19, 2011 15:37
Launch the OSX Color Picker and copy a HEX value to the clipboard
-- Launch the OSX Color Picker and copy a HEX value to the clipboard.
-- From: http://strawhousepig.net/index.php?focus=19
set theColor to (choose color)
set the clipboard to my RGB2HTML(theColor)
on RGB2HTML(RGB_values)
-- NOTE: this sub-routine expects the RBG values to be from 0 to 65536
set the hex_list to ¬
{"0", "1", "2", "3", "4", "5", "6", "7", "8", ¬
"9", "A", "B", "C", "D", "E", "F"}
______
< Mooo >
------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
<?php
class FooThing
{
var $message = 'foo';
function to_s() {
return $message;
}
function __toString() {
@fixlr
fixlr / development_httpd.conf
Created December 20, 2011 03:36
Short apache config for PHP app development. You need this because you probably already have Apache installed, and I'm jealous of Ruby.
# Load deez.
LoadModule alias_module /usr/libexec/apache2/mod_alias.so
LoadModule authz_host_module /usr/libexec/apache2/mod_authz_host.so
LoadModule dir_module /usr/libexec/apache2/mod_dir.so
LoadModule log_config_module /usr/libexec/apache2/mod_log_config.so
LoadModule mime_module /usr/libexec/apache2/mod_mime.so
LoadModule php5_module /usr/libexec/apache2/libphp5.so
LoadModule rewrite_module /usr/libexec/apache2/mod_rewrite.so
# Get down to bizness
@fixlr
fixlr / crazy.php
Created December 21, 2011 16:59
Crazy little PHP idea I was toying with this morning...
<?php
class Expectation
{
function __construct($value) {
$this->value = $value;
}
function toBe($expected) {
return $this->value === $expected;