Skip to content

Instantly share code, notes, and snippets.

View janeylicious's full-sized avatar

Jane janeylicious

  • san francisco
View GitHub Profile
@mrflip
mrflip / maximum_battery_life.md
Created March 19, 2012 08:32
maximum battery life checklist -- use before a long plane flight

Max Battery Life Checklist

Here is a checklist to follow if you want maximum battery life -- for instance if you're about to get on a long plane flight.

10 hour battery life on a non-SSD Macbook Pro 17"

Low power use checklist

With power connected:

@cbowns
cbowns / api_keys.rb
Created February 21, 2012 22:54
A script for Xcode 4.x to use API keys stored in ~/.api_keys and insert them into your app bundle’s Info.plist (instead of committing them to a repository)
# An API keys script written by Patrick Gibson (@patr1ck) and Christopher Bowns (@cbowns)
# This script sets API keys in your app's Info.plist from an .api_keys file you keep in your home directory (~/.api_keys)
# This allows you to not check API keys into your source control system,
# or for different developers to use different keys without needing to patch their working copies.
# Installation directions:
=begin
1. Create a Run Script build phase in your Xcode project before Compile Sources
2. Copy and paste this whole script in.
3. Create or modify your .api_keys file to hold your API keys
@mojombo
mojombo / vwilight.vim
Created January 26, 2011 03:23
vwilight.vim: A TRUE Twilight color theme for Vim
" Vim color file
" Converted from Textmate theme Twilight using Coloration v0.2.5 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
#!/usr/bin/env ruby
# This script converts xccolorthemes to dtvcolorthemes for porting xcode 3.x themes to xcode 4.x
# created by ashley towns <[email protected]>
# Public domain.
# ./dvtcolorconvert <inputfile>
# spits out a .dtvcolortheme file
require 'plist'
raise "Error: need a source file #{__FILE__} [file.xccolortheme]" if ARGV.length == 0
/*
* bewbs.c: In goes the bewbs, out goes the C!
* By: Jean-Nicolas Jolivet,(c)2010
* (.)(.) ++ptr
* (.){.} --ptr
* (.)[.] ++*ptr
* [.](.) -- *ptr
* [.][.] putchar(*ptr)
* {.}{.} *ptr=getchar()
* {.}[.] while(*ptr) {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.052 0.489 0.482 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0.432 0.325 0.276 1</string>

An Unordered and Incomplete List of Things You Should Probably Never Use/Do in Ruby

(thanks to Zach Drayer and Ben Stiglitz for their feedback)

  1. Don't use the implicit $_ style parameters where any reasonably sane person might expect a parameter, like #puts.
  2. Don't use the string-manipulation methods included in Kernel, like chomp, chop, sub, and gsub. Call them on String instances instead. If you use these methods in combination with $_ style parameters, you are why we can't have nice things.
  3. Don't use callcc, because it's inefficient, leaks like a sieve, and isn't included in most implementations.
  4. Don't call Array#pack or String#unpack to store data. YAML/Marshal are more powerful and miles saner.
  5. Don't use Kernel#test. Come on, this isn't Perl. Compare the fields of File.stat instead.
  6. Don't use Kernel#syscall or IO#syscall. You shouldn't even do this in C.