Skip to content

Instantly share code, notes, and snippets.

View brianpattison's full-sized avatar

Brian Pattison brianpattison

View GitHub Profile
@brianpattison
brianpattison / README.md
Last active January 27, 2017 18:49
Simple Scheduler Proposal (README first development)

This was the initial proposal for Simple Scheduler in the form of a README. The goal was to come up with a project that didn't exist, but solved all of our problems right in the README. And then write the code.

You can now find the actual README and the project here:

https://github.com/simplymadeapps/simple_scheduler

--

Simple Scheduler

@brianpattison
brianpattison / README.md
Last active February 13, 2016 19:04
Broccoli.js Sass compiling with glob imports

EXPERIMENTAL

The Rails asset pipeline has SCSS glob imports. Why isn't this possible everywhere? I made it possible with Broccoli.js.

SCSS

// web/static/css/admin.scss
@import "admin/variables";
@brianpattison
brianpattison / has_columns.scss
Last active January 12, 2016 18:50
"Has Columns" Flexbox SCSS Mixin
// Sets up a element and its child elements with the flexbox properties needed
// to have the given number of columns with optional gutters or margins.
$mobile-breakpoint: 500px !default;
@mixin has-columns($columns, $gutter: 0, $margin: 0) {
@include align-content(stretch);
@include align-items(stretch);
@include display(flex);
@include flex-direction(row);
@include flex-wrap(wrap);
@brianpattison
brianpattison / center_children.scss
Created January 12, 2016 18:35
Center children mixin
// Centers child elements horizontally and vertically without needing
// to set the height and width of the child elements using flexbox.
@mixin center-children {
@include align-content(center);
@include align-items(center);
@include display(flex);
@include flex-direction(column);
@include justify-content(center);
}
@brianpattison
brianpattison / filter.rb
Last active December 22, 2015 18:07
JSON API Resources Filtering
filter :before, apply: -> (records, value, _options) do
records.where("shop_orders.order_datetime < ?", value)
end
filter :after, apply: -> (records, value, _options) do
records.where("shop_orders.order_datetime > ?", value)
end
@brianpattison
brianpattison / README.md
Last active August 29, 2015 18:02
Google Material Design: Sass Color Function
@brianpattison
brianpattison / Gemfile
Last active March 12, 2021 00:29
Rails Livereload
source "https://rubygems.org"
ruby "2.2.2"
gem "rails", "4.2.0"
group :development do
gem "foreman"
gem "guard-livereload", require: false
gem "rack-livereload"
end
@brianpattison
brianpattison / spaces.rb
Created April 10, 2015 17:40
Spaces > Tabs
hash = {
aligning: "key/values",
is: "so much",
easier: "with spaces"
}
@brianpattison
brianpattison / jamon_hash.rb
Last active August 29, 2015 14:14
JamonHash.rb
class JamonHash < HashWithIndifferentAccess
def default(key = nil)
if key.is_a?(String) && key.include?(".")
find_value(key.split("."))
else
super
end
end
def find_value(keys)
@brianpattison
brianpattison / README.md
Last active August 29, 2015 14:01
MenuMotion Proposal

MenuMotion

MenuMotion is a RubyMotion wrapper inspired by Formotion for creating OS X status bar menus with a syntax that should feel familiar if you've used Formotion.

Installation

Add this line to your application's Gemfile:

gem "menu-motion"