Skip to content

Instantly share code, notes, and snippets.

View plasticine's full-sized avatar
🐧
Hello? Is this thing on?

Justin Morris plasticine

🐧
Hello? Is this thing on?
View GitHub Profile
// once the google maps is loaded, put a Raphael canvas on top of it
// be sure to apply margin:0 to the body in this case
var point = new GLatLng(46.065375, 5.448974);
var pixel = map.fromLatLngToContainerPixel(point);
var paper = Raphael(0, 0, 400, 300);
var circle = paper.circle(pixel.x, pixel.y, 10);
circle.attr("fill", "#f00");
circle.attr("stroke", "#fff");
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@mattmccray
mattmccray / backbone_helper.coffee
Created October 14, 2010 08:44
Use Backbone.js classes as native CoffeeScript classes
# Backbone CoffeeScript Helpers by M@ McCray.
# Source: http://gist.github.com/625893
#
# Use Backbone classes as native CoffeeScript classes:
#
# class TaskController extends Events
#
# class TaskView extends View
# tagName: 'li'
# @SRC: '<div class="icon">!</div><div class="name"><%= name %></div>'
@kolber
kolber / sequential-gallery.html
Created January 28, 2011 03:35
A dead simple, sequential image gallery (good for pulling together quick in-browser design presentations)

See all your work in a given repo over the last couple of weeks, collated by day. Makes filling out timesheets much easier.

To run the script, pass it a git repo as the first argument.

ruby timesheeting_like_a_boss.rb ~/projects/babushka

Here's what I see in babushka:

# 2011-05-25 (Wed)

c1dea1b: Return strings from #which and #cmd_dir.

@liquorice
liquorice / gist:1041979
Created June 23, 2011 05:49
bare bones method for grabbing and updating a users latest tweet (with no error handling whatsoever)
$.ajax({
url: 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=someonesplendid',
dataType: 'jsonp',
success: function(data) {
var tweet = data[0].text;
tweet = tweet.replace(/(http\:\/\/[A-Za-z0-9\.\/_]+)/g, '<a href="$1">$1</a>');
tweet = tweet.replace(/@([a-zA-Z0-9_]+)/g, '<a href="http://twitter.com/$1">@$1</a>');
$('#tweet').html(tweet);
}
});
@wadey
wadey / iterm2.zsh
Last active March 10, 2024 00:32
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
@jdennes
jdennes / LICENSE
Last active March 7, 2024 04:40
Subscribing to a Campaign Monitor list using AJAX
The MIT License (MIT)
Copyright (c) James Dennes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@irace
irace / BIWebViewDelegate.m
Created September 10, 2012 02:51
JavaScript/native bridge for iOS's UIWebView
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSString *urlString = [[request URL] absoluteString];
if ([urlString hasPrefix:@"js:"]) {
NSString *jsonString = [[[urlString componentsSeparatedByString:@"js:"] lastObject]
stringByReplacingPercentEscapes];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
@patsch
patsch / MountainLion-Java-Applet-Plugin.txt
Created October 24, 2012 23:47
Problems with the ATO Business Portal (or other Java Applets) & Mountain Lion's latest Java Update - this may help
After I applied the latest Apple Security Update around October 20th 2012 my Java Applets would no longer work;
in particular the ATO Business Portal which I need to submit quarterly data to the Australian Taxation Office.
When using Safari I always got a "Missing Plugin" error - even after I "Enabled Java" in the Security Preferences of Safari.
I confirmed that my Java version was up to date by running:
java -version
which gave me: