Skip to content

Instantly share code, notes, and snippets.

View gavinblair's full-sized avatar

Gavin Blair gavinblair

View GitHub Profile
@gavinblair
gavinblair / click.js
Created April 16, 2012 15:13
difference between simulated click and actual click
setInterval(function(){
$("#mybutton").click();
}, 1000);
$("#mybutton").click(function(e){
if(e.originalEvent === undefined) {
@gavinblair
gavinblair / gist:2353893
Created April 10, 2012 19:33
Birthday Wishes
Hello Gavin, the father. This is Past Gavin. I went ahead and renewed your licence sticker to 2013 since you probably have a lot on your mind already. Happy Birthday!
P.S. Next year you will have to renew the sticker AND your licence, so please pay it forward.
@gavinblair
gavinblair / LICENSE.txt
Created February 16, 2012 15:44 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@gavinblair
gavinblair / index.php
Created February 9, 2012 19:01
I always forget the syntax for this
<?php
//copy and paste me
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
@gavinblair
gavinblair / index.html
Created February 7, 2012 22:59
"randomly" angled highlights
<p class='highlighted'>
<span>This is a line</span>
<span>This is a line</span>
<span>This is a line</span>
</p>
@gavinblair
gavinblair / style.css
Created February 2, 2012 21:46
heading with bullets
h3 {
display: table;
width: 100%;
}
h3:before,
h3:after {
content: '\00a0';
width: 20%;
display: table-cell;
background: url(../img/320/bullet.gif) repeat-x 1px;
@gavinblair
gavinblair / query.sql
Created January 23, 2012 19:51
Add to a date in MySQL
SELECT date_add('2012-01-23', INTERVAL 7 DAY) -- returns 2012-01-30
@gavinblair
gavinblair / script.js
Created January 23, 2012 15:57
Get hash of an anchor
$("<a href='http://www.google.com#hello'>gavin</a>")[0].hash //returns "#hello"
$("#mylink")[0].hash //jquery selector
document.getElementById("mylink").hash //no jquery
@gavinblair
gavinblair / index.html
Created January 18, 2012 16:32
jScrollPane on an element with no children
...
<div id="scrollme">
lots of content here, but no child elements. Muffin caramels danish cotton candy carrot cake icing tiramisu ice cream candy canes. Jelly-o marshmallow toffee brownie halvah bear claw jelly-o bear claw. Dessert chupa chups ice cream sugar plum fruitcake marshmallow. Apple pie lemon drops biscuit sweet powder gingerbread. Wafer dragée tiramisu. Candy canes chocolate pudding cupcake chocolate cake biscuit jelly-o. Cookie muffin halvah jelly beans candy chupa chups. Topping danish tart. Donut oat cake toffee. Icing soufflé candy cotton candy jelly. Cake gingerbread powder. Danish applicake jelly cotton candy cheesecake.
Apple pie chocolate bar sugar plum gummies brownie wafer pastry gingerbread chocolate. Pudding liquorice toffee wafer apple pie jelly soufflé. Candy pastry bonbon marshmallow gingerbread candy canes cake sweet roll muffin. Bonbon icing faworki cotton candy dragée jelly. Chocolate jelly jujubes soufflé marshmallow bonbon tiramisu jelly beans. Jujubes macaroon jelly beans s
@gavinblair
gavinblair / validate.js
Created January 12, 2012 13:30
HTML5 placeholder and required for IE9
//from http://kamikazemusic.com/quick-tips/jquery-html5-placeholder-fix/#comment-938
$(document).ready(function() {
if (Modernizr.input.placeholder)
return;
$('input[placeholder]').focus(function() {
if ($(this).hasClass('placeholder')) {
if ($(this).val() == $(this).attr('placeholder'))
$(this).val('');
$(this).removeClass('placeholder');