Skip to content

Instantly share code, notes, and snippets.

View alexdunae's full-sized avatar

Alex Dunae alexdunae

View GitHub Profile
@alexdunae
alexdunae / smushit.sh
Created October 15, 2009 16:45
Image optimization with a home-rolled Smush.it
#!/bin/bash
#
# Home-rolled Smush.it, by Alex Dunae (http://dialect.ca).
#
# N.B. This script works for me; it may not work for you.
# Since it overwrites your images with the optimized version, you should
# backup your files before running this script and do a trial run before
# getting too excited. This is your disclaimer.
#
# Uses jpegtran (http://jpegclub.org/jpegtran/), part of libjpeg,
@alexdunae
alexdunae / simplelogin-secure-sample.php
Created December 1, 2010 19:22
Sample code for Simplelogin-Secure
<?php
// load the library
$this->load->library('SimpleLoginSecure');
// create a new user
$this->simpleloginsecure->create('user@example.com', 'uS$rpass!');
// attempt to login
if($this->simpleloginsecure->login('user@example.com', 'uS$rpass!')) {
// success
@alexdunae
alexdunae / wordpress_custom_post_gallery.php
Created March 31, 2011 23:55
Display a custom post type's media library inline on the WordPress edit page screen
<?php
define('MY_POST_TYPE', 'my');
define('MY_POST_SLUG', 'gallery');
function my_register_post_type () {
$args = array (
'label' => 'Gallery',
'supports' => array( 'title', 'excerpt' ),
'register_meta_box_cb' => 'my_meta_box_cb',
@alexdunae
alexdunae / fb-gallery-embed.html
Created September 24, 2011 17:05
Embedded Facebook Page Photo Gallery with jQuery
@alexdunae
alexdunae / media_tests.rb
Created September 30, 2011 19:07
Parse embed video URL snippet
test 'getting embed data for youtube urls' do
result = {:youtube => 'dQw4w9WgXcQ'}
['http://youtu.be/dQw4w9WgXcQ',
'http://www.youtube.com/embed/dQw4w9WgXcQ',
'http://www.youtube.com/watch?v=dQw4w9WgXcQ',
'https://www.YOUTUBE.com/?v=dQw4w9WgXcQ',
'http://www.youtube.com/v/dQw4w9WgXcQ',
'http://www.youtube.com/e/dQw4w9WgXcQ',
'http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ',
'http://www.youtube.com/sandalsResorts#p/c/54B8C800269D7C1B/0/dQw4w9WgXcQ',
@alexdunae
alexdunae / name_case.php
Created January 24, 2012 17:49
NameCaseConverter
<?php
/**
* Properly capitalize a name.
*
* @package NameCase
* @version 1.0.2
* @author Alex Dunae, Dialect <alex[at]dialect[dot]ca>
* @copyright Copyright (c) 2008, Alex Dunae
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @link http://dialect.ca/code/name-case/
Warning: get_browser(): browscap ini directive not set in /home/www/typothequen/new.typotheque.com/wf/web_fonts.php on line 81
Warning: get_browser(): browscap ini directive not set in /home/www/typothequen/new.typotheque.com/wf/web_fonts.php on line 16
Warning: get_browser(): browscap ini directive not set in /home/www/typothequen/new.typotheque.com/wf/web_fonts.php on line 32
Warning: get_browser(): browscap ini directive not set in /home/www/typothequen/new.typotheque.com/wf/web_fonts.php on line 48
Warning: get_browser(): browscap ini directive not set in /home/www/typothequen/new.typotheque.com/includes/classes/webfonts/web_fonts.class.php on line 441
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
[user]
name = Alex Dunae
email = alex@dunae.ca
[diff]
[color]
ui = auto
[core]
editor = subl -n -w
[credential]
helper = osxkeychain
#!/bin/bash
# Log output:
#
# * 51c333e (12 days) <Gary Bernhardt> add vim-eunuch
#
# The time massaging regexes start with ^[^<]* because that ensures that they
# only operate before the first "<". That "<" will be the beginning of the
# author name, ensuring that we don't destroy anything in the commit message
# that looks like time.