Skip to content

Instantly share code, notes, and snippets.

<div ng-class="condition ? 'class-if-true' : 'class-if-false'">
@matthewcopeland
matthewcopeland / image_tag.rb
Created August 18, 2012 23:24
Octobox Lightbox for Octopress - MVP
# line 42 of image_tag.rb
+++ "<span class=\"image-wrapper #{@img['class']}\"><img #{@img.collect {|k,v| "#{k}=\"#{v}\"" if v}.join(" ")}></span>"
--- "<img #{@img.collect {|k,v| "#{k}=\"#{v}\"" if v}.join(" ")}>"
@matthewcopeland
matthewcopeland / deploy.rb
Created September 29, 2012 07:09
Example capistrano deploy.rb, based on Ryan Bates' example http://railscasts.com/episodes/335-deploying-to-a-vps
require "bundler/capistrano"
server "96.126.100.112", :web, :app, :db, primary: true
set :application, "capteste"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :port, "3030"
<!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("campfire@2x.png");
$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