Skip to content

Instantly share code, notes, and snippets.

View stoplion's full-sized avatar
🎯
Focusing

George Norris stoplion

🎯
Focusing
  • Ottertune
  • Elsewhere
View GitHub Profile
@stoplion
stoplion / image_filters.rb
Created September 7, 2017 03:58 — forked from tonycoco/image_filters.rb
Useful image filters (Instagram/Hipster/Cool) for CarrierWave using MiniMagick (ImageMagick)
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
@stoplion
stoplion / image_filters.rb
Created September 7, 2017 03:58 — forked from tonycoco/image_filters.rb
Useful image filters (Instagram/Hipster/Cool) for CarrierWave using MiniMagick (ImageMagick)
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
@stoplion
stoplion / gulpfile.js
Created August 3, 2016 22:11 — forked from Darkle/gulpfile.js
Using Browserify, BrowserSync & Nodemon with Electron in Gulp.
'use strict';
var gulp = require('gulp')
var runSequence = require('run-sequence')
var path = require('path')
var browserSync = require('browser-sync').create()
var nodemon = require('gulp-nodemon')
var sourcemaps = require('gulp-sourcemaps')
var browserify = require('browserify')
var source = require('vinyl-source-stream')
@stoplion
stoplion / gist:a9d83bfddfa0eabeb2d9
Created December 8, 2015 06:38 — forked from deps/gist:6028795
A reminder to myself and anyone wanting to use Sinatra on Nitrous.IO
require 'sinatra'
# Set port for compatability with Nitrous.IO
configure :development do
set :bind, '0.0.0.0'
set :port, 3000 # Not really needed, but works well with the "Preview" menu option
end
get '/' do
"Sinatra on Nitrous.IO"
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
//
// Responsive Margin & Padding Shortcuts for Twitter Bootstrap 3.0
// ---------------------------------------------------------------
// This is an addition to Twitter Bootstrap that allows additional margin and padding shortcuts
// for enhanced layout control purposes. It should be included after the bootstrap.less
// import statement or precompiled as you see fit. It differs from bootstrap standards in
// that for any given screen size it predetermines the margin/padding size. All you have to
// do is specify the size you want xs,sm,md,lg, or xl. The exception is for items that you
// want to be centered using auto left/right margins. This can be device responsive by
// specifying mc-xs, mc-sm, mc-md, or mc-lg depending on when you want that behavior.
###
# Required Gems
###
###
# Settings
###
set :site_title, "Site name"

Behold, the nav_link:

The nav_link helper works just like the standard Rails link_to helper, but adds a 'selected' class to your link (or its wrapper) if certain criteria are met. By default, if the link's destination url is the same url as the url of the current page, a default class of 'selected' is added to the link.

<%= nav_link 'My Page', my_path %>

When my_path is the same as the current page url, this outputs:

<a class="selected" href="http://example.com/page">My Page</a>
@stoplion
stoplion / aspectratio.scss
Created September 24, 2012 18:39 — forked from brianmcallister/maintain-ratio.scss
Sass mixin for a responsive box that maintains an aspect ratio.
/*
Maintain ratio mixin.
@param {List} [$ratio] Ratio the element needs to maintain. A 16:9 ratio would look like this:
.element { @include maintain-ratio(16 9); }
*/
@mixin maintain-ratio($ratio: 1 1) {
$width: 100%;
$height: percentage(nth($ratio, 2) / nth($ratio, 1));
width: $width;
@stoplion
stoplion / gist:3647536
Created September 5, 2012 23:28
Everything you can override in a refinerycms project with refinerycms-blog
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*