Skip to content

Instantly share code, notes, and snippets.

@sebm
sebm / gist:794680
Created January 25, 2011 08:52
Explanation of UTF-8 header testing for Symfony / Swift Mailer
<?php
$expectedHeaderMessage = Swift_Message::newInstance()
->setSubject('Información')
->setCharset('utf-8')
;
$msgString = $expectedHeaderMessage->toString();
/*
echo $msgString:
@sebm
sebm / gist:959867
Created May 6, 2011 21:54
My error log from trying to install PHP from homebrew
enchilada:~ sebastian$ brew install php --with-apache --with-mysql
==> Downloading http://www.php.net/get/php-5.3.6.tar.gz/from/this/mirror
File already downloaded and cached to /Users/sebastian/Library/Caches/Homebrew
==> Downloading patches
==> Patching
patching file ext/tidy/tidy.c
==> ./configure --prefix=/usr/local/Cellar/php/5.3.6 --disable-debug --disable-d
==> make
==> make install
Installing PHP CLI binary: /usr/local/Cellar/php/5.3.6/bin/
@sebm
sebm / howold.py
Created May 22, 2011 22:01
Python script for printing time elapsed since stuff
#!/usr/bin/env python
from datetime import date
def how_long_between(dayA, dayB):
total_days = (dayA - dayB).days
years = total_days / 365
days = total_days % 365
months = days / 31
@sebm
sebm / gist:992881
Created May 26, 2011 10:10
Add a GitX symlink to /usr/local/bin
ln -s /Applications/GitX.app/Contents/Resources/gitx /usr/local/bin/gitx
@sebm
sebm / header.php
Created June 1, 2011 22:36
Customize WordPress's TwentyTen theme for Google +1.
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
@sebm
sebm / error log
Created June 29, 2011 22:37
A problem I'm encountering deleting embedded documents using Mongoose
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<Object> has no method 'remove'
at /Users/sebastian/japes/mongotest/mongotest.js:34:22
at /Users/sebastian/japes/mongotest/node_modules/mongoose/lib/mongoose/query.js:660:22
at model.init (/Users/sebastian/japes/mongotest/node_modules/mongoose/lib/mongoose/document.js:147:5)
at /Users/sebastian/japes/mongotest/node_modules/mongoose/lib/mongoose/query.js:658:16
at /Users/sebastian/japes/mongotest/node_modules/mongoose/support/node-mongodb-native/lib/mongodb/cursor.js:130:9
at /Users/sebastian/japes/mongotest/node_modules/mongoose/support/node-mongodb-native/lib/mongodb/cursor.js:176:11
@sebm
sebm / twittycity-cached-chart.js
Created August 26, 2011 09:52
Twitty City example cached chart data
data.addRows([
[new Date(2011, 7, 26, 8, 46), 2.54814814815, undefined, undefined, undefined, undefined],
[new Date(2011, 7, 26, 8, 41), 2.52, undefined, undefined, undefined, undefined],
[new Date(2011, 7, 26, 8, 36), 2.49333333333, undefined, undefined, undefined, undefined],
[new Date(2011, 7, 26, 8, 31), 2.49696969697, undefined, undefined, undefined, undefined],
[new Date(2011, 7, 26, 8, 26), 2.46666666667, undefined, undefined, undefined, undefined],
[new Date(2011, 7, 26, 8, 21), 2.5037037037, undefined, undefined, undefined, undefined],
[new Date(2011, 7, 26, 8, 16), 2.56296296296, undefined, undefined, undefined, undefined],
[new Date(2011, 7, 26, 8, 11), 2.54814814815, undefined, undefined, undefined, undefined],
[new Date(2011, 7, 26, 8, 6), 2.45, undefined, undefined, undefined, undefined],
@sebm
sebm / gist:1224202
Created September 17, 2011 18:26
My error log from trying to install Erlang via homebrew
... redacted ...
/usr/bin/llvm-gcc -m64 -O3 -march=core2 -w -pipe -I/private/tmp/homebrew-erlang-R14B03-5PBu/erlang-otp-e416814/erts/i386-apple-darwin10.8.0 -no-cpp-precomp -D_XOPEN_SOURCE -DHAVE_CONFIG_H -O2 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -I/private/tmp/homebrew-erlang-R14B03-5PBu/erlang-otp-e416814/erts/include -I/private/tmp/homebrew-erlang-R14B03-5PBu/erlang-otp-e416814/erts/include/i386-apple-darwin10.8.0 -I/private/tmp/homebrew-erlang-R14B03-5PBu/erlang-otp-e416814/erts/include/internal -I/private/tmp/homebrew-erlang-R14B03-5PBu/erlang-otp-e416814/erts/include/internal/i386-apple-darwin10.8.0 -DEPMD_PORT_NO=4369 -o /private/tmp/homebrew-erlang-R14B03-5PBu/erlang-otp-e416814/erts/obj/i386-apple-darwin10.8.0/epmd.o -c epmd.c
/usr/bin/llvm-gcc -m64 -O3 -march=core2 -w -pipe -I/private/tmp/homebrew-erlang-R14B03-5PBu/erlang-otp-e416814/erts/i386-apple-darwin10.8.0 -no-cpp-precomp -D_XOPEN_SOURCE -DHAVE_CONFIG_H -O2 -Wall -Wstrict-prototypes -Wmissing-proto
@sebm
sebm / convert_mp3s_to_oggs.sh
Created October 3, 2011 21:13
A shell command to convert all .mp3 files in a directory into .ogg files
find . -name "*.mp3" -type f -exec ffmpeg -i {} -acodec libvorbis -aq 30 {}.ogg \;
@sebm
sebm / .gvimrc.after
Created December 13, 2011 04:32
My Vim dotfiles, used with Janus
color ir_black
set gfn=Consolas:h15