This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Color < Struct.new(:r, :g, :b) | |
def self.hex(value) | |
new(*value.to_s.delete('#').scan(/../).map(&:hex)) | |
end | |
def hex | |
"%.2X%.2X%.2X" % values | |
end | |
def to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
article { | |
counter-reset: figure; | |
} | |
article figure { | |
counter-increment: figure; | |
} | |
article figure > figcaption:before { | |
content: "Fig. " counter(figure) ": "; | |
} | |
html[lang=de] article figure > figcaption:before { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var listViewsRoot = window | |
;(function(ns){ | |
// LIST ITEMS | |
ns.ListItem = Backbone.View.extend({ | |
tagName: 'li', | |
template: '<%= id %>', | |
render: function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }, {}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Duration | |
attr_accessor :from, :till | |
def initialize(from: nil, till: nil) | |
@from = from || Time.now | |
@till = till || Time.now | |
end | |
def seconds | |
(till - from).round |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Schmutz | |
Types = { | |
feinstaub: ["\u0323", "\u0307", "\u0312"], | |
mettwurst: ["\u0314", "\u031C", "\u0358", "\u0353", "\u0335"], | |
nein_nein: ["\u0337", "\u0338", "\u0336", "\u0335", "\u20d2", "\u20d3", "\u20e5", "\u20e6", "\u20eb"] | |
}.freeze | |
Types.each do |name, runes| | |
define_singleton_method name do |input, prop = 0.25| | |
mangle(input, runes, prop) |