Skip to content

Instantly share code, notes, and snippets.

custom_framework_name:
path: "/path/to/your/stylesheets"
semantic_classes:
".col1": ".span-4"
".col2": ".span-8"
".col3": ".span-12"
".col4": ".span-16"
".col5": ".span-20"
".col6": ".span-24"
".fixleft": ".clear"
@fixlr
fixlr / spinner.html
Created July 2, 2010 14:02
Pure html/css activity animation for webkit browsers
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
<style type="text/css" media="screen">
.spinner {
$(".with_default").each(function() {
i = $(this);
i.val(i.attr("default"));
i.focus(function() {
if (i.val() == i.attr("default")) {
i.val('');
i.removeClass("with_default");
}
});
i.blur(function() {
@fixlr
fixlr / gist:357888
Created April 6, 2010 18:02
Default values for passing an array in to a PHP function
<?php
function example($params = array()) {
$defaults = array(
"one" => 1,
"two" => 2,
"three" => 3);
$params = array_merge($defaults, $params);
return $params;
$search_scope_hits_jquery .= <<<HTML
<script type="text/javascript">
$.get("index.php?{$search_scope_hits_url}",
function(data){
document.getElementById('search_scope_hits_{$scope_name}').innerHTML = ' ('+ data + ')';
}
);
</script>
HTML;
@fixlr
fixlr / gbs_covers.js
Created January 7, 2010 16:39
Add Google Book cover art to a webpage.
var DEBUG = false;
var MAXBUFFER = 10;
function debug_init() {
this.debug_log = document.createElement("div");
this.debug_log.id = 'debug';
this.debug_log.setAttribute('style', "min-height: 1em; width: 95%; border: 1px solid #FF6400; margin-left: auto; margin-right: auto;");
h2 = document.createElement('h2');
h2.setAttribute('style', "color: #fff; background-color: #FF6400; margin: 0 0 0.75em 0; height: 1.5em; font-size: 1.2em; padding: 5px 0 3px 0;");
h2.innerHTML = 'DEBUG LOG';
@fixlr
fixlr / gist:251770
Created December 8, 2009 16:29
One-liner to add a new line of text after the regex matches
awk '{print};/foo/{print "bar"}' example.txt
@fixlr
fixlr / gist:231270
Created November 10, 2009 21:09
DSpace: Determine size (in bytes) of a community (top of 3 tiers)
SELECT SUM(size_bytes)
FROM bitstream, bundle, bundle2bitstream, item2bundle
WHERE item2bundle.bundle_id = bundle2bitstream.bundle_id
AND bundle2bitstream.bitstream_id = bitstream.bitstream_id
AND item2bundle.bundle_id = bundle.bundle_id
AND bundle.name = 'ORIGINAL'
AND item2bundle.item_id = ANY(
SELECT item_id
FROM item
WHERE owning_collection = ANY(
@fixlr
fixlr / gist:231267
Created November 10, 2009 21:07
DSpace: Determine number of collections in a Community (top of 3 tiers)
SELECT count(collection_id)
FROM community2collection
WHERE community_id = ANY(
SELECT child_comm_id
FROM community2community
WHERE parent_comm_id = 19);
@fixlr
fixlr / parss.rb
Created September 18, 2009 19:41
Build a custom RSS feed for Penny Arcade comics and news posts
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'rss/maker'
class PA
attr_accessor :date