Skip to content

Instantly share code, notes, and snippets.

View jwpage's full-sized avatar

Johnson Page jwpage

View GitHub Profile
<?php
class Gettext_Twig_Extension extends Twig_Extension
{
public function getFilters()
{
return array(
't' => new Twig_Filter_Function('gettext'),
);
}
<?php
/* log.txt format
---
{
'version' : 0.0.1
}
---
[2010-07-12T15:47:40+10:00] (0h, 0m, 11s)
*/
<!DOCTYPE>
<html>
<head>
<title></title>
<!-- from http://attacklab.net/showdown/ -->
<script src="showdown.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
$(function() {
var refreshRate = 3;
#!/bin/bash
# Simple script to toggle the "When switching to an application, switch to a
# space with open windows for the application" option in Settings > Expose &
# Spaces > Spaces.
#
# Handy for times when you don't want to be easily distracted by things in
# another space.
swoosh=`defaults read com.apple.dock workspaces-auto-swoosh`
// Bookmarklet to remove @mentions from a page on Twitter (probably not #newtwitter).
// Useful for when you're checking out someone's profile and want to see what they tweet,
// and not what they reply to.
javascript:var s = document.getElementsByClassName("status");var removes = [];for(var i=0; i<s.length; i++) { var n = s[i]; var txt = n.getElementsByClassName("entry-content")[0].innerHTML; if(txt.replace(/^\s*/, "").charAt(0) == "@") { removes.push(n.getAttribute("id")); }}for(var i=0; i<removes.length; i++) { var el = document.getElementById(removes[i]); el.parentNode.removeChild(el);}void(0);
(all taken, yo)
<del>
Extreme Programming Explained - Kent Beck, 2000
Extreme Programming Explored - William C. Wake, 2001
Planning Extreme Programming - Kent Beck, Martin Fowler, 2000
Extreme Programming for Web Projects - Wallace, Isobel Ragget, Joel Aufgang, 2002
Extreme Programming Installed - Ron Jeffries, Ann Anderson, Cher Hendrickson, 2000
Agile Web Development with Rails, 2nd Ed - Dave Thomas, DHH, 2007
</del>
@jwpage
jwpage / gist:1558743
Created January 4, 2012 06:10
Amazon Links from Back to Work
<?php
$dsn = ""; // As per PDO DSN syntax
$pdo = new PDO($dsn, null, null, array(
PDO::ATTR_PERSISTENT => true,
));
$conn = Doctrine_Manager::connection($pdo);
@jwpage
jwpage / gist:3125864
Created July 16, 2012 23:39
Precompile ember handlebars templates with gruntjs
/*
Adapted from: https://gist.github.com/2013669
Usage:
grunt.initConfig({
ember: {
all: {
src: 'templates/*.hjs',
dest: '../build/templates.compiled.js',
ember: 'path/to/ember.js',
@jwpage
jwpage / gist:4701603
Created February 3, 2013 12:34
Alllll the functions in Zend_Date
<?php
abstract class Zend_Date
{
public function __construct ($date = null, $part = null, $locale = null);
public static function setOptions (array $options = array ());
public function getTimestamp ();
public function setTimestamp ($timestamp);
public function addTimestamp ($timestamp);
public function subTimestamp ($timestamp);