Skip to content

Instantly share code, notes, and snippets.

View averyvery's full-sized avatar

Doug Avery averyvery

View GitHub Profile
@averyvery
averyvery / gistdeck.md
Created July 27, 2012 18:41
GistDeck example

Crafting a presentation can be difficult

Too many tools

tools

@averyvery
averyvery / Gemfile
Created July 5, 2012 16:14
Gemfile
source 'http://rubygems.org'
# Compiling
gem 'compass'
gem 'compass-growl'
# Guard
gem 'guard'
gem 'guard-compass'
gem 'guard-livereload'
gem 'guard-process'
@mixin mobile_bg($file){
background-image: image-url('mobile/standard/#{$file}');
@media screen and (-webkit-min-device-pixel-ratio: 2) {
background-image: image-url('mobile/retina/#{$file}');
background-size: image-width('mobile/standard/#{$file}') image-height('mobile/standard/#{$file}');
}
}
// Usage
@averyvery
averyvery / Guardfile
Created July 3, 2012 21:06
Retina images with Guard
guard 'process', :name => 'shrink-images', :command => 'ruby resize-mobile-images.rb mobileretina' do
watch /^images\/mobileretina\/.+/
end
@averyvery
averyvery / Guardfile
Created July 3, 2012 21:05
Guarding with Juicer
guard 'process', :name => 'minify-screen-js', :command => 'juicer merge js/all.js -o js/all.min.js --force -s' do
watch /^js\/brianregan\/screen.js/
end
@averyvery
averyvery / fit_bg.css.scss
Created July 3, 2012 21:02
Fitted backgrounds using Compass
@mixin fit_bg($url){
background-image: image-url($url);
display: block;
height: image-height($url);
width: image-width($url);
}
// Usage
.nav-about {
@include fit_bg('assets/structure/nav/about.png');
@averyvery
averyvery / Guardfile
Created June 14, 2012 21:15
Minifying JS, shrinking retina images down
guard 'compass' do
watch /^.+(\.s[ac]ss)/
end
guard 'process', :name => 'minify-screen-js', :command => 'juicer merge js/all.js -o js/all.min.js --force -s' do
watch /^js\/brianregan\/screen.js/
end
guard 'process', :name => 'minify-mobile-js', :command => 'juicer merge js/mobile.js -o js/mobile.min.js --force -s' do
watch /^js\/brianregan\/mobile.js/
<% set_bg @page.slug %>
<section class="layout">
<article>
<% if @page.image.present? %>
<%= render 'shared/pic',
:url => @page.image.url,
:alt => @page.title(current_locale),
@averyvery
averyvery / .vimrc
Created June 8, 2012 22:32
A few things I wish I'd done as soon as I started with Vim
" relative linenumber. very helpful for "8yy"-style operations
set relativenumber
" once you get used to virtualedit=all, it's so great
set virtualedit=all
" setting this allows you to undo into previous sessions, all the way back to the start of a file
" (providing the path hasn't changed).
" very useful with the Vundle plugin
set undofile
@averyvery
averyvery / .vimrc
Created April 22, 2012 21:27
Navigating Indents in Vim
" Indent navigation in vim - https://gist.github.com/gists/2467046/
" Adapted from http://vim.wikia.com/wiki/Back_and_forth_between_indented_lines_again
" Use Option+hjkl to navigate to the start/end of indents, or move in/out of indented code
" Additionally, combine the actions <, >, d, and y with these four movements
" This is useful for quickly performing actions on functions, objects, anything that begins and ends with a matching indent level
"
" Examples:
" <opt-j> at a function's start moves to the end of the function
" ><opt-j> at a function's start indents the whole function another level.
" y<opt-k> at a function's end yanks the entire thing