Skip to content

Instantly share code, notes, and snippets.

View pifantastic's full-sized avatar

Aaron Forsander pifantastic

  • Stripe
  • Austin, TX
View GitHub Profile
<?php
class cli {
public static $pb_length = 50;
public static $pb_start = '[';
public static $pb_end = ']';
public static $pb_bg = ' ';
public static $pb_fg = '=';
public static $pb_head = '>';
<?php
$title = "Whats up?";
echo preg_replace('/[^[:alnum:]]/', '', $title);
=== modified file 'drupal/includes/theme.inc'
--- drupal/includes/theme.inc 2011-05-26 02:58:29 +0000
+++ drupal/includes/theme.inc 2011-08-22 21:07:48 +0000
@@ -253,7 +253,10 @@
* to add more theme hooks.
*/
function drupal_rebuild_theme_registry() {
- cache_clear_all('theme_registry', 'cache', TRUE);
+ if (lock_acquire(__FUNCTION__)) {
+ cache_clear_all('theme_registry', 'cache', TRUE);
alias ..='cd ..'
alias ...='cd ../..'
alias ~='cd ~'
alias ll='tree --dirsfirst -CFupDaLg 1'
# Fire ze missiles!
# ex. nuke @dev, or nuke @test
function nuke() {
sudo /etc/init.d/varnish restart;
sudo /etc/init.d/httpd restart;
class Appointment(models.Model):
# ... #
def save(self, *args, **kwargs):
update_series = kwargs.pop('update_series', True)
super(Appointment, self).save(*args, **kwargs)
if update_series and self.rrule:
rrule = self.rrule.get_rrule()
<?php
// A little header help.
$branch_conf_path = getcwd() . '/../.bzr/branch/branch.conf';
if (!headers_sent() && file_exists($branch_conf_path)) {
$branch_conf = file_get_contents($branch_conf_path);
foreach (explode("\n", $branch_conf) as $line) {
list($key, $value) = explode("=", $line, 2);
if (trim($key) == 'bound_location') {
@pifantastic
pifantastic / results.txt
Created August 18, 2011 20:19
Looks like calling an empty function is faster than checking if a function exists. Could be handy designing frameworks.
3.93 ms
1.68 ms
// Constructor
var client = new beard.Client({
followRedirects: true,
timeout: 60,
encoding: 'utf-8',
windowize: false
});
// Get/set any of those options at any time with:
client.option('followRedirects', false);
<ul>
<li>One
<li>two
VS.
<ul>
<li>One</li>
<li>Two</li>
</ul>
<?php
/**
* Provides methods for time and memory profiling
*
* $Id$
*
* @package Pifanstatic
* @author Aaron Forsander
* @copyright (c) 2009 Aaron Forsander