Skip to content

Instantly share code, notes, and snippets.

@burtyish
burtyish / random link button
Created April 19, 2013 11:14
Clicking on the button will send the visitor to a random link from the link array.
@burtyish
burtyish / dabblet.css
Created November 4, 2013 13:55
Solar panel background
/**
* Solar panel background
*/
background-color: #3eb2e7;
background-image: linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
background-size: 7px 7px, 7px 7px;
@burtyish
burtyish / dabblet.css
Created November 6, 2013 17:11
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.arrow-up {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
@burtyish
burtyish / dabblet.css
Created November 6, 2013 17:11
CSS Triangles
/**
* CSS Triangles
*/
.arrow-up {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
@burtyish
burtyish / dabblet.css
Created January 27, 2014 15:39
zig-zag background (SO)
/**
* zig-zag background (SO)
* CSS Zigzag Border with a Textured Background
*/
background: linear-gradient(#BCED91 49%, transparent 49%),
linear-gradient(-45deg, white 33%, transparent 33%) 0 50%,
white linear-gradient(45deg, white 33%, #BCED91 33%) 0 50%;
background-repeat: repeat-x;
background-size: 1px 100%, 40px 40px, 40px 40px;
@burtyish
burtyish / django-pageable-collection.coffee
Last active August 29, 2015 13:58
An extension of Backbone.PageableCollection to parse server responses created by Django Rest Framework.
define [
'jquery',
'underscore',
'backbone',
'backbone-pageable'
], ($, _, Backbone) ->
###
An extension of Backbone.PageableCollection to parse server responses created by Django Rest Framework.
The response structure is expected to match that provided by django-rest-framework's Pagination mechanism
@burtyish
burtyish / gist:31cfe7730e5825f702a1
Last active August 29, 2015 14:04
Chart.js configuration
chart_options: (data)->
min = Math.min 0,data...
max = Math.max data...
num_of_y_ticks = 5
scale_minmax_rounding_factor = if max > 10000 then 1000 else 500
y_scale_rounding_factor = if max > 10000 then 5000 else 1000
scale_max = scale_minmax_rounding_factor * Math.round(max/scale_minmax_rounding_factor)
scale_min = scale_minmax_rounding_factor * Math.round(min/scale_minmax_rounding_factor)
y_scale_step_size = (scale_max - scale_min) / (num_of_y_ticks)
y_scale_step_rounded = y_scale_rounding_factor * Math.round(y_scale_step_size / y_scale_rounding_factor)
@burtyish
burtyish / listify.coffee
Created September 23, 2014 07:45
A Handlebars.js helper that stringifies an array into readable form.
define [
'hbs/handlebars'
'underscore'
], (Handlebars, _) ->
"""
Breaks down an array into a comma-delimited list and 'and' before the last item.
Options:
total_count - If this is a number greater than the length of array, the difference will be added as 'and x others'.
first_item - this item will be inserted at the beginning of the array.
Examples:
@burtyish
burtyish / An experiment in vector image (SVG).markdown
Last active August 29, 2015 14:21
An experiment in vector image (SVG)
@burtyish
burtyish / New React component template (createClass)
Last active August 29, 2016 12:16
WebStorm template for new ES6 React component file. Converts hyphen-separated filenames to PascalCase class name.
#set( $lowerCaseName = "$NAME" )
#set( $newName = "" )
#foreach( $part in $NAME.split("-") )
#set( $newName = "$newName$part.substring(0,1).toUpperCase()$part.substring(1)")
#end