Skip to content

Instantly share code, notes, and snippets.

View gavinanderegg's full-sized avatar

Gavin Anderegg gavinanderegg

View GitHub Profile
@gavinanderegg
gavinanderegg / gist:9338617
Last active August 29, 2015 13:56
Find the next first Tuesday of the month
<!doctype html>
<html>
<head>
<title>Next first Tuesday of the month</title>
</head>
<body>
<div id="nextMeetupTime"></div>
<script>
Hi Friend,
Have a good day !
This is seamless and welded stainless steel pipes at here !
Mainly supply 300 serial austenite pipes.
Process method: annealing, pickling
@gavinanderegg
gavinanderegg / gist:1685822
Created January 26, 2012 23:27
Python date
import datetime
now = datetime.datetime.now()
then = datetime.datetime(month=11, year=2009, day=9)
print now - then
# 808 days, 19:06:17.113214
@gavinanderegg
gavinanderegg / Folder Preferences
Created December 16, 2011 23:12 — forked from chrisyour/Folder Preferences
Show hidden files and hidden folders (except .git) in your TextMate project drawer
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences.
# Instructions:
# Go to TextMate > Preferences...
# Click Advanced
# Select Folder References
# Replace the following:
# File Pattern
@gavinanderegg
gavinanderegg / gist:1470021
Created December 13, 2011 01:50
WordPress post_password_required() backwardness
// From: http://core.trac.wordpress.org/browser/trunk/wp-content/themes/twentyten/loop.php#L69
<div class="entry-content">
<?php if ( post_password_required() ) : ?>
<?php the_content(); ?>
<?php else : ?>
<?php
$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
if ( $images ) :
$total_images = count( $images );
@gavinanderegg
gavinanderegg / gist:1102657
Created July 24, 2011 14:12
Hopefully fixed in 5.4
<?php
class thing
{
function bar()
{
return array(1, 2, 3);
}
}
@gavinanderegg
gavinanderegg / gist:1030400
Created June 16, 2011 21:59
Static class vars
<?php
class Foo
{
public static $my_static = 'foo';
}
print Foo::$my_static . "\n";