Skip to content

Instantly share code, notes, and snippets.

View colinta's full-sized avatar
🏠
Working from home

Colin T.A. Gray colinta

🏠
Working from home
View GitHub Profile
@colinta
colinta / gist:1213040
Created September 13, 2011 02:54
Adding inline support to coffeekup
commit dc175e2a03a27cac22a70e99d1784018491f0751
Author: Colin Thomas-Arnold <colinta@mac.com>
Date: Mon Sep 12 20:51:55 2011 -0600
added '.inline' to all tag functions.
Usage: p "This text could use #{strong.inline(a.inline href: "/", 'a link')}."
TODO: It'd be cooler, but impossible I think, to have strong.inline(a href:'/','a link').
diff --git a/src/coffeekup.coffee b/src/coffeekup.coffee
@colinta
colinta / Default (Linux).sublime-keymap
Created January 10, 2012 19:27 — forked from optilude/Default (OS X).sublime-keymap - User
A version of the Sublime Text 2 plugin at http://www.sublimetext.com/forum/viewtopic.php?f=5&t=2260&start=0 that makes for TextMate-like clipboard history
[
{ "keys": ["ctrl+x"], "command": "clipboard_manager_cut" },
{ "keys": ["ctrl+c"], "command": "clipboard_manager_copy" },
{ "keys": ["ctrl+v"], "command": "clipboard_manager_paste", "args": { "indent": true } },
{ "keys": ["ctrl+ctrl+v"], "command": "clipboard_manager_paste", "args": { "indent": false } },
{ "keys": ["ctrl+alt+v"], "command": "clipboard_manager_next_and_paste" },
{ "keys": ["ctrl+shift+v"], "command": "clipboard_manager_previous_and_paste" },
@colinta
colinta / python_piped.py
Created January 22, 2012 21:58
I don't care, I think it's cool.
_filter = filter
class filter(object):
def __init__(self, lamb):
self.lamb = lamb
def __ror__(self, val):
return _filter(self.lamb, val)
[1,2,3] | filter(lambda x: x<3)
#> [1, 2]
@colinta
colinta / greatmigration.sh
Created February 9, 2012 18:41
Changes the origin from fusionbox-testing.com to dev.fusionbox.com
function confirm()
{
echo -n "$1 [y]" >&2
read yn
if [[ "$yn" != "n" ]]; then
echo 1
fi
}
@colinta
colinta / move_text.md
Created March 6, 2012 21:39
move_text

Since there is already a binding for "m+":

Vintage/Default.sublime-keymap:

{ "keys": ["m", "<character>"], "command": "vi_set_bookmark",
    "context": [{"key": "setting.command_mode"}]
},

You might have trouble getting the keymap you want. But try this:

@view_config(renderer='myapp:templates/blog_detail.j2')
@has_tag_cloud # ug, but I need that tag_cloud!
def blog_detail(request, blog_slug):
blog = fetch_blog(blog_slug)
return {}
@view_config(renderer='myapp:templates/tag_cloud.j2')
@has_tag_cloud # silly, since this *is* the tag cloud...
def tag_cloud(request, blog_slug):
@colinta
colinta / base.jinja2
Created March 16, 2012 17:07
I wish jinja2 could extend blocks.
<!doctype html>
<title>{{ title or "My Title" }}</title>
<body>
{% block headers %}{% endblock %}
{% block content %}{% endblock %}
</body>
@colinta
colinta / bookstore.py
Created April 16, 2012 17:21 — forked from chroto/bookstore.py
SA Bookstore
"""
# Bookstore
- Book => Images
- Book <=> Author
- Book <=> Genre
- Book -> Genre (Primary)
NSString *text = @"You are one chromosome away from being a potato.";
// escape spaces and such
text = [text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *urlString = [NSString stringWithFormat:@"http://www.translate.google.com/translate_tts?tl=en&q=%@",text];
NSURL *url = [NSURL URLWithString:urlString];
def rgba_color(r, g, b, a=1)
UIColor.colorWithRed((r/255.0), green:(g/255.0), blue:(b/255.0), alpha:a)
end
class MyApplicationController < UIViewController
def viewDidLoad
font = UIFont.fontWithName('DS-Digital', size:20)
color = rgba_color(255, 255, 255)