Skip to content

Instantly share code, notes, and snippets.

View doolin's full-sized avatar

Dave Doolin doolin

View GitHub Profile
@doolin
doolin / stupid_null_cast_trick.c
Created December 11, 2010 04:42
Casting 0 to \0 (or 0x0)
We couldn’t find that file to show.
@doolin
doolin / ruby_2d_array.rb
Created December 11, 2010 17:47
Simple 2D Array Behavior in Ruby
#!/usr/bin/env ruby
#Scientific programming deals with arrays of numbers.
#Here's a quick snippet showing how Ruby behaves with arrays.
strike_dip = [ [ 12.0, 30.0 ],
[ 43.0, 12.0 ]]
puts "Whole array"
puts strike_dip
@doolin
doolin / mdproc.rb
Created December 12, 2010 19:51
Using kramdown to process markdown to latex and html
#!/usr/bin/env ruby
# This is what I'm using to process a directory full
# of kramdown (~markdown) files.
#
# Copyright 2010 David M. Doolin ([email protected])
#
# License: Public domain.
# And a little transclusion demo...
@doolin
doolin / stringstuff.c
Created January 24, 2011 05:07
Simple string hoo hah for argc, argv
#include <stdio.h>
#include <string.h>
int
main(int argc, char ** argv) {
while (argc--) {
printf("Arg %d: %s, strlen: %lu\n",argc, argv[argc], strlen(argv[argc]));
}
@doolin
doolin / custom_functions.php
Created February 24, 2011 22:10
Footer function for There Is No Box
/** Add this to Thesis custom_functions.php */
if (file_exists(THESIS_CUSTOM . '/tinobox_footer.php')) {
include(THESIS_CUSTOM . '/tinobox_footer.php');
remove_action('thesis_hook_footer','thesis_attribution');
add_action('thesis_hook_footer','tinobox_footer');
}
@doolin
doolin / doolin.css
Created May 16, 2011 00:22
Thematic function for tacking a link to dool.in
div.doolin {
position: fixed;
bottom: 5px;
right: 5px;
}
@doolin
doolin / person.rb
Created June 6, 2011 01:14
person_spec.rb
class Person < ActiveRecord::Base
validates :first_name, :presence => true
validates :last_name, :presence => true
end
@doolin
doolin / svn_overwrite.sh
Created June 15, 2011 15:19
svn overwriting a WordPress installation
#!/usr/bin/sh
# This script will overwrite an existing
# WordPress installation with the current
# head of trunk. Once it has been reverted,
# you may need to update the database, and
# WP will prompt you for that automatically.
# This is untested with these options!
# The script commands work from the command
@doolin
doolin / functions.php
Created August 28, 2011 00:49
How to check for and include art.php
# Put this in your functions.php file
if (file_exists(TEMPLATEPATH . '/art.php')) {
include(TEMPLATEPATH . '/art.php');
}
@doolin
doolin / tinymce.php
Created December 16, 2011 23:02
Demo code for WordPress TinyMCE
<?php
/*
Plugin Name: Demo Plugin TinyMCE
Plugin URI: http://website-in-a-weekend.net/demo-plugins/
Description: A brief description of the Plugin.
Version: 0.1
Author: Dave Doolin
Author URI: http://website-in-a-weekend.net/
*/