Skip to content

Instantly share code, notes, and snippets.

View nicinabox's full-sized avatar

Nic Haynes nicinabox

View GitHub Profile
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
textarea.textarea {
width: 50%;
max-width: none;
}
@nicinabox
nicinabox / Readme.md
Created June 28, 2012 15:34
Elastic navigation for responsive designs

Elastic navigation

Demo

Accepts 1 parameter:

  • An integer that is the width to stop being elastic

app.js

@nicinabox
nicinabox / elastic.scss
Created June 14, 2012 16:38
Elastic navigation
@mixin elastic-nav($width: 100%) {
display: table;
table-layout: fixed;
width: $width;
> li {
display: table-cell;
> a {
width: auto;
}
}
@nicinabox
nicinabox / routes.rb
Created June 5, 2012 19:03
Static routes in Rails
get ":action", :to => "static", :action => /[a-z-]+/, :as => :static
@nicinabox
nicinabox / gist:2770226
Created May 22, 2012 16:55
Regex to fix Sequel Pro's CSV formatting
[\n]+([^\d])
@nicinabox
nicinabox / gist:2586814
Created May 3, 2012 16:04
Load image with callback
var loadImage = function($img, callback) {
var image;
image = new Image();
return $img.load(function() {
if (typeof callback === 'function') {
callback(this);
}
return this;
});
};
@nicinabox
nicinabox / accordion.js
Created May 2, 2012 21:58
Use an accordion dynamically in a Refinery page
if ($('#main').hasClass('accordion')) {
$('#main .content h3').each(function(index) {
content = $(this).nextUntil('h1, h2, h3')
content.wrapAll('<section />')
});
}
$('#main.accordion .content').accordion({
header: 'h3',
collapsible: true,
@nicinabox
nicinabox / env.sh
Created May 1, 2012 18:27
Pack Chrome extensions from the command line
# $ crx `pwd`
function crx() {
~/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --pack-extension=$@ --pack-extension-key=$@/key.pem
}
@nicinabox
nicinabox / style.scss
Last active October 3, 2015 15:58
Center UL
ul {
position: relative;
float: left;
left: 50%;
li {
position: relative;
float: left;
left: -50%;
}
}
@nicinabox
nicinabox / 1_migration.md
Created April 23, 2012 16:14
Add a key image to Refinery

Create migrations

rails g migration add_key_image_to_refinery_page key_image_id:integer

rake db:migrate

Override Page model

rake refinery:override model=refinery/page