Skip to content

Instantly share code, notes, and snippets.

@max-power
max-power / CSS3-Figure-Counter.css
Last active December 11, 2015 11:48
CSS3 Counter for Figures
article {
counter-reset: figure;
}
article figure {
counter-increment: figure;
}
article figure > figcaption:before {
content: "Fig. " counter(figure) ": ";
}
html[lang=de] article figure > figcaption:before {
@max-power
max-power / Backbone.ListViews.js
Last active December 9, 2015 21:59
Backbone.js Collection Views: - UnorderedList - OrderedList - Table
var listViewsRoot = window
;(function(ns){
// LIST ITEMS
ns.ListItem = Backbone.View.extend({
tagName: 'li',
template: '<%= id %>',
render: function(){
@max-power
max-power / backbone.mongomodel.js
Created August 23, 2012 20:06
Backbone MongoModel: embbedded models and collections.
Backbone.MongoModel = Backbone.Model.extend({
idAttribute: '_id',
embedded: {},
parse: function(i){
_.each(this.embedded, function(klass,k){ i[k] = new klass(i[k], {parse: true}) })
return i
},
toJSON: function(){
return _.reduce(this.attributes, function(o,v,k){ o[k] = v && v.toJSON ? v.toJSON() : v; return o }, {})
}
@max-power
max-power / LICENSE.txt
Created July 20, 2012 19:19 — forked from 140bytes/LICENSE.txt
Geographic coordinate conversion Latitude/Longitude to Degrees, Minutes, Seconds
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@max-power
max-power / geolocation_polyfill.js
Created May 3, 2012 06:12
HTML5 Geolocation Polyfill
// requires jquery.js, tested with reqwest.js with jquery compat mode
// uses http://geoplugin.net/json.gp
// lowercase arguments are just string placeholder
// F = Function placeholder
// Z = Cache placeholder
;(function(N,g,c,x,y,u,j,F,Z) {
F=function(s,e){Z?s(Z):$.ajax({url:'//'+u+'.net/'+j+'.gp',dataType:j+'p',jsonp:j+'callback',error:e,success:function(R){Z={};Z[c]={};Z[c][x]=R[u+'_'+x];Z[c][y]=R[u+'_'+y];s(Z)}})}
N[g]=N[g]||{getCurrentPosition:F,watchPosition:F,clearWatch:function(){Z=undefined}}
@max-power
max-power / LICENSE.txt
Created April 3, 2012 01:02 — forked from 140bytes/LICENSE.txt
number to human byte size
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE