Matěj Grabovský mgrabovsky

View StringMap.js
1 2 3 4 5 6 7 8 9 10
// Copyright (C) 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
View xmonad.hs
1 2 3 4 5 6 7 8 9 10
-- vim: expandtab shiftwidth=4 tabstop=4 :
-- Based on https://gist.github.com/yeban/311016
import XMonad
 
import qualified Data.Map as M
import qualified XMonad.StackSet as W
 
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.EwmhDesktops
import XMonad.Layout.Grid
View fibonacci.hs
1 2 3 4
psi = (1 + sqrt 5) / 2
 
fib :: Integral a => a -> a
fib = round . (/ sqrt 5) . (psi ^)
View gist:8163399
1 2 3 4 5 6 7 8 9 10
(define-syntax is
(syntax-rules (a)
((_ x a y?)
(y? x))
((_ x a y? f a y?*)
(f (y? x)
(y?* x)))
((_ x a y? f x* a y?*)
(f (y? x)
(y?* x*)))))
View gist:7912279
1 2 3
import itertools
 
([1, 2, 5][i % 3] * 10**(i // 3) for i in itertools.count(0))
View gist:6262709
1 2 3 4 5 6 7
var node_list = document.getElementsByClassName('fancybox'),
nodes = [].slice.call(node_list);
 
var values = nodes.reduce(function(memo, current) {
var value = current.getAttribute('href');
return memo.concat(value);
}, []);
View post-receive
1 2 3 4 5 6 7 8 9 10
#!/bin/sh
# See also: GIT_DIR, GIT_WORK_TREE (core.worktree)
# @TODO: Back up before updating, possibly keep a few previous versions in a tarball
# See http://codex.wordpress.org/WordPress_Backups
# @TODO: Keep a list of updates, i.e. time, hash, perhaps commit message
# @TODO: Preserve modifications throughout deployments (untracked+ignored)
REPOSITORY_PATH=/www/srsniweb.git
git update-server-info
while read old_hash new_hash ref; do
View cycle.coffee
1 2 3 4 5 6 7 8
cycle = (values) ->
length = values.length
current = 0
-> values[current++ % length]
 
# Usage
c = cycle [1..3]
console.log c() for [1..5] # => 1 2 3 1 2
View gist:1808014
1 2 3 4 5 6 7 8 9 10
// http://stackoverflow.com/a/2553109/227159
 
template < class T >
class temp_value {
public :
temp_value(T& var) : _var(var), _original(var) {}
~temp_value() { _var = _original; }
private :
T& _var;
T _original;
View gist:1072629
1 2 3 4 5 6 7 8
var t = window.setTimeout(callback, 300);
var cb = function() {
window.clearTimeout(t);
callback();
};
 
// If this doesn't call cb() in 300 ms, callback() will trigger automatically
remote.call('method', cb);
Something went wrong with that request. Please try again.