Skip to content

Instantly share code, notes, and snippets.

@polarblau
polarblau / random_number_blocks.js
Created April 12, 2013 10:29
Creates blocks of random numbers in required length. Needed this to create a master password at https://yritys.tunnistus.fi/ .
function randomNumberBlocks(l, bl) {
for(var i=0,b=Array(l).join(' ').split(' ');i<l;i++)
for(var j=0;j<bl;j++)
b[i] += Math.floor(Math.random()*10);
return b.join(' ');
}
randomNumberBlocks(4, 4);
// => "5553 7870 7480 2855"
@polarblau
polarblau / fonts.css
Created April 24, 2013 17:06
`+font-face` is provided by the Bourbon Sass framework — http://bourbon.io/docs/#font-face .
@font-face {
font-family: sonar-bold;
font-weight: bold;
font-style: normal;
src: url("/fonts/sonar-bold-webfont.eot");
src: url("/fonts/sonar-bold-webfont.eot?#iefix") format("embedded-opentype"), url("/fonts/sonar-bold-webfont.woff") format("woff"), url("/fonts/sonar-bold-webfont.ttf") format("truetype"), url("/fonts/sonar-bold-webfont.svg#sonar-bold") format("svg"); }
@font-face {
font-family: sonar-medium;
font-weight: normal;
@polarblau
polarblau / mail_branch.sh
Created April 24, 2013 21:09
“Send a branch via email”. Depends on `mutt`.
#!/bin/bash
RECIPIENT="name@domain.com"
# current branch
CURRENT=$(git symbolic-ref -q HEAD)
CURRENT=${CURRENT##refs/heads/}
CURRENT=${CURRENT:-HEAD}
# branch names
$ = jQuery
$.fn.extend
progress: (options) ->
settings =
strokeWidth : 6
strokeColor : '#15d701'
strokeColorFull: '#e73921'
duration : 1500
%button
background: transparent url("shared/buttons_sprite.png") no-repeat
width: 40px
height: 40px
&:hover
background-position: -40px 0
$button-types: add, remove, edit
$ypos : 0
(function($) {
// which methods should be silenced?
var silenceBinders = ['On', 'One'];
function silenceArguments(arguments) {
// convert arguments to array
var args = Array.prototype.slice.call(arguments, 0);
// the last argument should be the callback
(function() {
var oldSort = Array.prototype.sort;
Array.prototype.sort = function(compareFunction) {
return oldSort.call(this, compareFunction || function(a, b) {
return a - b;
});
}
})();
# SyntaxError: unexpected ':', expecting =>
person = {
first_name : 'John',
last_name : 'Doe',
date_of_birth: '01.01.1971'
}
# works
person = {
first_name: 'John',
@polarblau
polarblau / config.ru
Created June 19, 2013 20:01 — forked from adamesque/config.ru
Protect a Middleman application via basic auth
require 'rubygems'
require 'middleman/rack'
protected_middleman = Rack::Auth::Basic.new(Middleman.server) do |username, password|
[username, password] == ['theuser', 'thepassword']
end
run protected_middleman
/*!
* Baseline Grid
*
* Renders a baseline grid on top of your page
*
* Copyright 2014 Florian Plank
* Released under the MIT license
*
*
* Usage: