Skip to content

Instantly share code, notes, and snippets.

View kayluhb's full-sized avatar

Caleb Brown kayluhb

View GitHub Profile
@kayluhb
kayluhb / html
Created November 28, 2012 15:03
Gallery
<section class="gallery">
<img src="/media/slide.jpg" alt="Alt Text" width="600" data-text="Slide Text" />
<img src="/media/slide.jpg" alt="Alt Text" width="600" data-text="Slide Text 2" />
<div class="detail"></div>
<nav>
<a href="#" class="ir next" title="Next">Next</a>
@kayluhb
kayluhb / gist:2988292
Created June 25, 2012 12:27
Convert hash rockets to new ruby hash syntax
perl -pi -e 's/:([\w\d_]+)(\s*)=>/\1:/g' **/*.rb
def recurring_text(self):
days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday"]
weeks = ["first", "second", "third", "fourth", "fifth"]
ret = ""
# Daily
if self.recurring_type == '2':
ret += "Daily"
@kayluhb
kayluhb / gist:2322678
Last active October 2, 2015 21:17
reconcile a forked repo
# add a reference to the original repo
git remote add --track <branch> upstream git://github.com/<original-repo>.git
# verify you added it
git remote
# fetch the changes
git fetch upstream
# merge it
@kayluhb
kayluhb / gist:2003247
Created March 8, 2012 20:29
VPS Product finder
class ProductFinder < ActiveRecord::Base
class << self
def search(miles, zip, brand=nil, storeType=nil)
now = DateTime.now.utc
d = now.strftime("%d")
params = "action=results&zip=#{zip}&miles=#{miles}"
params += "&brand=#{brand}" unless brand.blank?
params += "&storeType=#{storeType}" unless storeType.blank?
@kayluhb
kayluhb / Spin me right round baby.
Created February 26, 2012 01:37
The best key frame animation ever.
@-webkit-keyframes killerdiller {
from { -webkit-transform: rotate(-45deg); }
to { -webkit-transform: rotate(360deg); }
}
body
{
-webkit-animation: killerdiller 0.5s infinite;
-webkit-animation-timing-function: linear;
}
@kayluhb
kayluhb / select.js
Created December 19, 2011 19:51
Custom Select plugin
/* Custom Select plugin */
(function($){
$.fn.extend({
customSelect: function(opts) {
if(!$.browser.msie || ($.browser.msie&&$.browser.version > 6)){
return this.each(function() {
var $el = $(this), cur = $el.find(':selected');
$el.after('<span class="' + $el.attr('class') + '"><span class="inner">' + cur.text() + '</span></span>')
.css({ position:'absolute', opacity:0, fontSize:$el.next().css('font-size') });
var span = $el.next(), inner = span.find(':first-child');
/**
* Pie
*/
#pie { position: relative; float: left; width: 374px; height: 374px; margin: 0; padding: 0; }
#pie ul { list-style-type: none; width: 374px; height: 374px; padding: 0; margin: 0; }
#pie li { position: absolute; top: 0px; width: 374px; height: 374px; padding: 0; margin: 0; }
#pie p { width: 374px; height: 374px; padding: 0; margin: 0; }
#pie span { display: block; width: 187px; height: 374px;}
#pie ul :nth-child(odd) { clip: rect(0px, 374px, 374px, 187px);}
@kayluhb
kayluhb / gist:1479180
Created December 14, 2011 23:58
canvas
var canvas = document.getElementById('kettle'),
ctx = canvas[0].getContext('2d');
ctx.save();
ctx.beginPath();
ctx.moveTo(0.0, 0.0);
ctx.lineTo(155.6, 0.0);
ctx.bezierCurveTo(155.6, 0.0, 155.3, 62.1, 155.3, 80.7);
ctx.lineTo(155.3, 244.2);
ctx.bezierCurveTo(155.3, 294.2, 198.5, 319.9, 276.3, 319.9);
@kayluhb
kayluhb / gist:1479176
Created December 14, 2011 23:56
kettle
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="kettle" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="529" height="387" >
<g>
<defs>
<rect id="SVGID_1_" width="529" height="387"/>
</defs>
<clipPath id="SVGID_2_">