Skip to content

Instantly share code, notes, and snippets.

View 13k's full-sized avatar

K 13k

View GitHub Profile
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Sends a bunch of links to delicious.
#
# This script depends on pydelicious library, which can be found here:
# http://code.google.com/p/pydelicious/
#
# Command-line usage:
#
# delicious_send.py <username> <password> <file with links> [file2, file3, ... ]
@13k
13k / 0001-Horizontal-size-and-alignment.patch
Created February 9, 2009 07:11
Patches Guake (9a41f1f8b7ce073302e864cd71901c0628d818be) to have horizontal size and alignment
From 9a41f1f8b7ce073302e864cd71901c0628d818be Mon Sep 17 00:00:00 2001
From: Kiyoshi de Brito Murata <13k@kside.net>
Date: Mon, 9 Feb 2009 05:03:32 -0200
Subject: [PATCH] Horizontal size and alignment
---
data/guake.schemas | 32 +++++-
data/prefs.glade | 274 ++++++++++++++++++++++++++++++++--------------
src/guake.py | 92 +++++++++++-----
src/guake_globals.py.in | 3 +
class Array
def slices(*args)
args.map do |arg|
case arg
when Range, Fixnum
self[arg]
else
raise ArgumentError, "Arguments for slices() must be either Fixnum or Range"
end
end
#!/bin/sh
# Pushes current branch to remote branch possibly with different names
# With no arguments, pushes to origin +<branch>:<branch> where <branch>
# is the same branch name as current.
# With one argument, pushes to origin +<branch>:<argument>
head=`git symbolic-ref HEAD`
branch=`basename $head`
git push origin +$branch:${1:-$branch}
#!/bin/sh
#
# Identifies the predominant color in an image.
# You can specify certain colors to discard from the result.
#
# Usage: $0 <image> [colors to discard]
[ -z "$1" ] && exit 1
file="$1"
@13k
13k / irbrc.rb
Created September 24, 2009 19:58
def Object.method_added(method)
return super(method) unless method == :helper
helper.instance_variable_set("@controller", app)
def helper.method_missing(method, *args, &block)
helper.send(method, *args, &block) if helper.instance_variable_get('@controller') && method.to_s =~ /_path$|_url$/
end
end if ENV['RAILS_ENV']
@13k
13k / ackrc
Created October 5, 2009 02:26
--type-set
haml=.haml
require 'rexml/parsers/pullparser'
require 'htmlentities'
class String
# Truncate strings containing HTML code
# Usage example: "string".truncate_html(50, :word_cut => false, :tail => '[+]')
def truncate_html(len = 30, opts = {})
opts = {:word_cut => true, :tail => ' ...'}.merge(opts)
p = REXML::Parsers::PullParser.new(self)
tags = []
"
" CSS 1-line comment helpers
"
" Comments the current line
fun CssComment()
:s@^\(\s*\)\(.*\)$@\1/*\2*/@
endfun
" Un-comment from current line