Skip to content

Instantly share code, notes, and snippets.

View derekblank's full-sized avatar

Derek Blank derekblank

  • Queensland, Australia
View GitHub Profile
@derekblank
derekblank / modals.html.erb
Created January 14, 2015 03:56
Painless syntax highlighting in Rails
<% modal_markup = capture do %>
<div class="modal">
<label for="modal-1">
<div class="btn js-btn">Open Modal</div>
</label>
<input class="modal-state" id="modal-1" type="checkbox" />
<div class="modal-window">
<div class="modal-inner">
<label class="modal-close" for="modal-1"></label>
<h1>Sign In</h1>
@derekblank
derekblank / each.scss
Created February 9, 2014 17:36
Multi-dimensional each loop in Scss
// Irregular Sprite List
// The following icons have varying dimensions
// Key: icon-name background-position-x, background-position-y, absolute-position-x, absolute-position-y, width, height
$irregular-list:
dashboard -69px 0 45px 29px 46px 45px,
download -23px -121px 0 6px 33px 26px,
head-double -69px -123px 40px 34px 58px 36px,
head-stats -69px -46px 44px 31px 55px 39px,
head-with-tie -69px -85px 45px 34px 44px 37px,
@derekblank
derekblank / gist:7372431
Created November 8, 2013 15:16
app/public/config.php
<?php
/**
* Config Variables
*
* This file consist primarily of path variables to simplify
* the inclusion of assets and partials.
*/
/**
* If your deployment is in a directory update this variable
var alternateLineGraphData = {
labels: ["Jul 2013", "Aug 2013", "Sep 2013", "Nov 2013", "Dec 2013"],
datasets: [
{
fillColor: "#2c3e50",
strokeColor: "#111",
data: [630,185,403,495,174]
},
{
fillColor : "#3498db",
var chartCanvas = function(name, size) {
var $canvas = $('#' + name + '-canvas');
$canvas.attr(size || {
width : '200',
height : '200'
});
return $canvas.get(0) && $canvas.get(0).getContext("2d");
}
@derekblank
derekblank / map-interaction.js.coffee
Created June 11, 2013 20:57
Allow user to interact with Raphael regions
for region of worldRaphael
((rg, region) =>
worldRaphael[region].node.id = region
rg[0].onmouseover = (e) =>
rg.animate
fill: @hoverColor, 200
rg[0].onmouseout = (e) =>
rg.animate
fill: @baseColor, 200
rg[0].onclick = (e) =>
@derekblank
derekblank / map-init.js.coffee
Last active December 18, 2015 09:19
Initialize constructor and init functions for map.js.coffee
class WorldMap
constructor: ->
@baseColor = '#f5f3e6' # set the base fill color of the vector shapes
@hoverColor = '#053a5a' # set hover color
@R = Raphael('map', 960, 543) # create the canvas element #map and define dimensions
@defaultAttr =
fill: @baseColor # define default attributes for all paths
@init()
init: =>
@derekblank
derekblank / map.js.coffee
Created June 11, 2013 03:03
CoffeeScript to create an interactive map of the world using SVG and Raphaël.js
class WorldMap
constructor: ->
@baseColor = '#f5f3e6' # set the base fill color of the vector shapes
@hoverColor = '#053a5a' # set hover color
@R = Raphael('map', 960, 543) # create the canvas element #map and define dimensions
# define default attributes for all paths
@defaultAttr =
fill: @baseColor
'cursor': 'pointer'
'stroke-opacity': 0.001
@derekblank
derekblank / each.css.scss
Last active December 17, 2015 10:09
Sass @each loop examples
// Standard loop
@each $item in web, design, strategy, development, video, marketing {
&#wwd-#{$item} {
background-image: url('bg-wwd-#{$item}.jpg');
}
}
// Multi-dimensional loop
@derekblank
derekblank / figures-of-peach.txt
Last active November 14, 2017 21:33
Figures of Peach
Cut me some slacks. There's more than one way to spin a cat.
The early bird gets to La Vergne, but you can't have cake and heat it too.
We can burn the British when we get there, but for now you need to come
down off your pedal stool, because to the victim go the spoils.
You're taking too much for granite and just preaching to require.
This is strong that broke the camel's back, so tape your pick:
You're either double's advocate or you're just making a half-harded effort.
Either way, you have a huge ship on your shoulder.
You're a hare's breath away from a wind-wind situation.
I know every road has its thorns, but you're getting too big for you bridges.