Skip to content

Instantly share code, notes, and snippets.

View kalupa's full-sized avatar

Paul Kalupnieks kalupa

View GitHub Profile
@kalupa
kalupa / redirect_to_first_child.php
Created April 2, 2009 14:49
Wordpress Redirect To First Child Page
<?php
/*
Template Name: Redirect To First Child
*/
if (have_posts()) {
while (have_posts()) {
the_post();
$pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order");
$firstchild = $pagekids[0];
wp_redirect(get_permalink($firstchild->ID));
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cufón / examples / text-shadow</title>
<script src="../js/cufon.js" type="text/javascript"></script>
@kalupa
kalupa / foo.rb
Created November 9, 2009 19:14
Example of doing a Table-less ActiveRecord
class Foo < Tableless
column :bar, :string
validates_presence_of :bar
end
@kalupa
kalupa / gist:510443
Created August 5, 2010 21:49
image size setting
---
:dialog_thumb: c106x106
:grid: c135x135
:preview: c96x96
:small: 110x110>
:medium: 225x255>
:large: 450x450>
paul@salt:~$ dpkg --get-selections | grep mysql
libdbd-mysql-perl install
libmysql-ruby1.8 install
libmysqlclient15-dev install
libmysqlclient15off install
mysql-client install
mysql-client-5.0 install
mysql-common install
mysql-server install
mysql-server-5.0 install
+------------+----------+----------------------------------------------------------------+
| Engine | Support | Comment |
+------------+----------+----------------------------------------------------------------+
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys |
| BerkeleyDB | NO | Supports transactions and page-level locking |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) |
| EXAMPLE | NO | Example storage engine |
| ARCHIVE | YES | Archive storage engine |
#!/usr/bin/ruby
require 'osx/foundation'
OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework'
include OSX
$d=File.basename Dir.pwd
Dir.chdir '..'
fsevents_cb = proc do |stream, ctx, numEvents, paths, marks, eventIDs|
system "rsync -vcir ~/projects/karrupa/neuchatel/site/sites/all/* controllercode.com@controllercode.com:/nfs/c06/h01/mnt/88354/domains/neuchatel.karrupa.com/html/sites/all/"
How are you doing, today?
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
@kalupa
kalupa / cleverButton.css.sass
Created August 10, 2011 01:06 — forked from olivierlacan/cleverButton.css.sass
cleverButton Sass mixin for Compass
// ##### cleverButton #####
// # Version: 0.3
// # Description: Sass mixin for Compass to create fully styled buttons.
// # Notes: this mixin uses Compass mixin, see http://compass-style.org for
// # installation instructions.
// # Authors: Olivier Lacan, Andrew Smith
// ### changelog
// # v0.1: July 2010, initial version
// # v0.2: Added edge extendable edge styles
// # v0.3: Added Compass CSS3 mixins for reduced code & better browser support