Skip to content

Instantly share code, notes, and snippets.

@matthewcopeland
matthewcopeland / localstore_nav_controller.js
Created September 23, 2015 20:23
Using local storage to maintain navigation collapse state.
angular.module("app.controllers")
.controller("NavCtrl", [
"$scope",
"$window",
function($scope, $window) {
$scope.toggleCollapse = function() {
$scope.collapsed = !$scope.collapsed;
setCollapsed($scope.collapsed);
};
@matthewcopeland
matthewcopeland / gulpfile.js
Created September 23, 2015 01:42
Gulpfile example
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var del = require('del');
var es = require('event-stream');
var bowerFiles = require('main-bower-files');
var print = require('gulp-print');
var Q = require('q');
// == PATH STRINGS ========
<div ng-class="condition ? 'class-if-true' : 'class-if-false'">
<!DOCTYPE>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/knockout/2.3.0/knockout-min.js"></script>
<style>
html, body {
padding: 0;
margin: 0;
}
@matthewcopeland
matthewcopeland / 01_sassygrid.scss
Last active December 10, 2015 13:48
Created a single control point for adding column-classes to the sassygrid by adding sass-loops and an array of column-classes. Related to spree PR https://github.com/spree/spree/pull/2221
//---------------------------------------------------------------------------------------------------
// a sassier grid for spree
// fixed-width - html whitespace not removed.
// intended to be used as magic-classes, coupling markup&style.
// based on skeleton v1.1 by dave gamache - thanks dude
//
//---------------------------------------------------------------------------------------------------
//- Contents
//--- Grid classes
//--- Grid Variables
@matthewcopeland
matthewcopeland / color_loops.scss
Created December 21, 2012 11:43
This is a utility shows the use of a variable array, the native sass length-function, and a @mixin that uses @if and @for loops to apply colors to some svg and elements in a consistent order.
// color palette.
$white: #ffffff;
$grey: #ccc;
$greyblue: #5C6F7B;
$blackblue: #162934;
$lightblue: #29AAE2;
$darkblue: #006FAB;
$lightgreen: #B1BA1D;
$darkgreen: #8D8A00;
$brightred: #C4122F;
@matthewcopeland
matthewcopeland / animation.scss
Created December 12, 2012 07:16
A fun animation with sass loops.
$campfire-size: 100px;
#campfire {
position: fixed;
right: $gutter;
bottom: $gutter/2;
height: $campfire-size;
width: $campfire-size;
background: $campfire-2x;
background-size: 100%;
}//#campfire
$campfire: image-url("campfire.png");
$campfire-2x: image-url("[email protected]");
$star: image-url("star.png");
$tree: image-url("tree.png");
$campfire-logo: image-url("campsite.png");
$next-arrow: image-url("travel-camp-to-left.png");
$prev-arrow: image-url("travel-camp-to-right.png");
$ants-fruits-flowers-eggs: image-url("ants-fruits-flowers-eggs.png");
$boomerang: image-url("boomerang.png");
@matthewcopeland
matthewcopeland / 01_terminal
Created November 6, 2012 18:03
Postgres start/stop commands
# Start Postgres
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
# Stop Postgres
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log stop
@matthewcopeland
matthewcopeland / 01_svg_wip.html.erb
Created October 22, 2012 22:07
WIP - svg spike for rose chart.
<h1>SVG Spike</h1>
<% # rose chart trig
rose_chart_size = 500
# faux variables
dist1 = 100/2
dist2 = 200/2
dist3 = 300/2
dist4 = 400/2
dist5 = 500/2