Skip to content

Instantly share code, notes, and snippets.

View kneath's full-sized avatar
🌲
Growing soil

Kyle Aster kneath

🌲
Growing soil
View GitHub Profile
// Examples:
//
// button_to "Mark as unread", mark_as_unread_message_path(message), :method => :put, :class => "form_to_link"
// button_to "New Alert", new_alert
//
jQuery(document).ready(function($) {
jQuery('.form_to_link').each(function(el){
var form = el.parents('form');
form.after('<a href="' + form.attr('action') + '" class="button_link_to">' + form_to_link.attr('value') + '</a>');
form.hide();
// Beginning of a Ubiquty script for use with xtt
CmdUtils.CreateCommand({
name: "xtt",
takes: {status: noun_arb_text},
preview: function(previewBlock, statusText) {
var previewTemplate = "Updates your XTT status to: <br/>" +
"<b>${status}</b><br /><br />";
var previewData = {
Element.implement({
getDimensions: function() {
return {width: this.getStyle('width', true), height: this.getStyle('height', true)};
},
visible: function() {
return this.getStyle('display') != 'none';
},
toggle: function() {
return this[this.visible() ? 'hide' : 'show']();
},
#!/bin/sh
# VHostit
# Simple bash script to add a virtual host to apache & your hosts file on OS X
#
# Installation
# Throw vhostit.sh somewhere in your path. I like to copy it to /usr/local/bin/vhostit
# Usage
# `vhostit domain.tld` from within the directory you want to host.
# The domain.tld will be added to your hosts file and a VirtualHost added to your apache's httpd.conf\
-- Quicksilver script to post your status to XTT via xttc (http://github.com/jnewland/xttc/tree/master)
-- Put into ~/Library/Application Support/Quicksilver/Actions, enable scripts, relaunch QS
-- To activate, start quicksilver type . (period), enter your status, tab over and type 'tt' and press enter
using terms from application "Quicksilver"
on process text tt
set xtt_status to quoted form of (tt)
set results to do shell script "xttc " & xtt_status
-- display dialog results
return nothing
end process text
#!/usr/local/bin/ruby
# Fun script to see your income potential if you bill hourly
# Calculates how many billable days are in a given month and approximates
# your income potential depending on the input below
#
# To use: save as a file on your system, chmod +x and call it. Example:
# $ ./billable.rb
# $ Week days: 22
# $ 101% of normal
/**
* Format any UTC timestamp on the page to the users local timezone.
*/
var DateFormat = {
autoParse: function(){
$$('span.timestamp').each(function(span) {
var utc = Date.parseUTC(span.innerHTML);
var rel = span.getAttribute('rel');
span.update(rel == 'words' ? utc.timeAgoInWords() : utc.strftime(rel))
});
/**
* Format any UTC timestamp on the page to the users local timezone.
*/
var DateFormat = {
autoParse: function(){
$$('span.timestamp').each(function(span) {
var utc = Date.parseUTC(span.getAttribute('utc'));
var rel = span.getAttribute('format');
span.set('html', rel == 'words' ? utc.timeAgoInWords() : utc.strftime(rel))
});
<!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" 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">
button, a.button{
@kneath
kneath / gist:143225
Created July 8, 2009 21:53
My sad messed up sphinx dbs
code(master) % ls db/sphinx/test
comment_core.spa discussion_search_cache_delta.spi user_core.spm
comment_core.spd discussion_search_cache_delta.spl user_core.spp
comment_core.sph discussion_search_cache_delta.spm user_delta.spa
comment_core.spi discussion_search_cache_delta.spp user_delta.spd
comment_core.spm faq_core.spa user_delta.sph
comment_core.spp faq_core.spd user_delta.spi
comment_delta.spa faq_core.sph user_delta.spm
comment_delta.spd faq_core.spi user_delta.spp
comment_delta.sph faq_core.spl user_search_cache_core.new.spa