Skip to content

Instantly share code, notes, and snippets.

View brettbuddin's full-sized avatar
🤖
Arguing with computers.

Brett Buddin brettbuddin

🤖
Arguing with computers.
View GitHub Profile
$('a.button').click(function() {
alert('Hello world!');
return false; // This prohibits the link's default behavior.
});
$('a').click(function(event) { event.preventDefault(); alert('Murkturgler!'); });
$('sidebar a').click(function(event) {
event.stopPropegation();
});
$('sidebar').click(function() {
alert('A child was clicked!'); // This won't fire if an anchor is clicked.
});
$('', { id: 'refresh-button' });
$('', {
id: 'refresh-button',
href: 'http://google.com',
click: function(e) {
e.preventDefault(); alert('Sup?');
},
mouseover: function() {
$(this).addClass('active');
},
mouseout: function() {
var button = function(opts) {
var options = $.extend({ className: 'button', text: 'Change Me' }, opts);
return $('', options);
};
button({text: 'New Widget', href: '/new'}).appendTo('body');
@brettbuddin
brettbuddin / gist:1544619
Created December 31, 2011 17:19
Grabs the current file's directory
DIRECTORY=$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
var lectric_slider = new Lectric();
lectric_slider.init("#featured_images", {
next:".lectric_right_arrow",
previous:".lectric_left_arrow",
tossing: true,
tossFunction: function(x, dx, dt) {
return x + dx * 100 / dt;
},
hooks: {
init: function(s) {
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
go
› go install github.com/brettbuddin/victor/examples/bot
go
› bot -adapter campfire -name virbot
2012/06/09 19:45:23 Starting up...
2012/06/09 19:45:24 Fetched room info.
2012/06/09 19:45:24 Remembering: Brett Buddin
2012/06/09 19:45:24 Joined room.
2012/06/09 19:45:24 Listening...
2012/06/09 19:45:33 Listener /^(virbot[:,]?)\s*(?:(image|img) (.*))/ triggered by 'virbot img what'