Skip to content

Instantly share code, notes, and snippets.

@rayboyd
rayboyd / will_paginate.rb
Created March 21, 2009 14:11
Renders a helpful message with numbers of displayed vs. total entries. Drop into config/init folder and restart the server.
#
# WillPaginate::ViewHelpers
#
module WillPaginate
module ViewHelpers
#
# Renders a helpful message with numbers of displayed vs. total entries.
#
# + Only displayed if the collection.size is within the range of
@rayboyd
rayboyd / html_rails_mp.rb
Created March 21, 2009 14:19
Rails html monkey patch. More hassle than it's worth, handy to have none-the-less.
# This is an absolutely fucking infuriating monkey patch that allows rails
# to output valid html 4 (i.e leave some tag open)
# See http://rails.lighthouseapp.com/projects/8994/tickets/1565-patch-allow-disabling-of-self-closing-tags-generation-taghelpertag
# Dogmatic, clueless or just plain blind arrogance?
module ActionView
module Helpers
module TagHelper
include ERB::Util
from waveapi import simplejson
data = simplejson.loads(JSON)
"""TODO"""
def trace(obj):
yield obj
sprint = (lambda key, value: '%s => %s' % (key, value))
typeof = (lambda obj, collection: type(obj) in collection)
@rayboyd
rayboyd / gist:255121
Created December 12, 2009 22:42 — forked from rcarver/gist:192350
<script type="text/javascript">
// *** EXPERIMENTAL ***
//
// This is an experimental method to be notified when Typekit's fonts have loaded.
//
// It will almost certainly change! Please do not use this on a live site. Please
// do let us know what you think by forking this gist, contacting us at
// support@typekit.com or on Get Satisfaction - http://getsatisfaction.com/typekit
//
//
// jQuery Twitter
//
// user
var username = 'rayboyd';
// callback
var callback = 'parseTwitterFeed';
Default Fonts in the iPhone SDK
--------------
Family name: AppleGothic
Font name: AppleGothic
Family name: Hiragino Kaku Gothic ProN
Font name: HiraKakuProN-W6
Font name: HiraKakuProN-W3
Family name: Arial Unicode MS
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
int sendrecv(redis rdbs, const char *fmt, ...)
{
va_list ap;
char *buf;
char *tmpbuf;
size_t bufsize = 0;
int arglen = 0;
for (;;) {
var agent = {
perpage: '15',
since_id: '0',
query: null,
page: null,
completed_in: null,
next_page: null,
refresh_url: null,
results: {
cache: []
int sendrecv(libre rdb, char *sendbuf)
{
int s, r;
char recvbuf[LIBRE_MAX_BUFSIZE];
/* send data */
s = send(rdb->fd, sendbuf, strlen(sendbuf), 0);
if (s < 0) return LIBRE_FAILURE;
free(sendbuf);