Skip to content

Instantly share code, notes, and snippets.

@Ficik
Ficik / putty.reg
Created February 9, 2018 23:58
My putty settings
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham]
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Jumplist]
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions]
@Ficik
Ficik / maybe.js
Created October 10, 2017 00:11
Maybe monad
const GenericMaybe = isNothing => {
const Nothing = value => {
const self = _ => self;
return self;
}
const Just = value => (fn, ...tail) => tail.length > 0 ? Maybe.from(fn(value))(...tail) : Maybe.from(fn(value))
const log = (value, resolve) => (...args) => console.log(...args, value) || resolve;
const Maybe = fn => value => Maybe.from(fn(value))
@Ficik
Ficik / index.html
Created May 2, 2016 17:08
Simple fetch file uploader with file input and dropzone
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="uploader.js"></script>
<style media="screen">
.dropzone {
padding:40px;
background-color:silver;
/**
* Calls last function passed in after {timout} ms
* from last passed function
* usefull for expensive typeahead and searches
*/
var throttle = function(timeout){
var lastCalled;
var lastFn;
var checking = false;
@Ficik
Ficik / scope.js
Created July 9, 2014 15:04
Simple directive creating scope
angular.module('scope',[])
.directive('scope', function(){
return {
scope: true,
transclude: true,
compile: function compile(tElement, tAttrs, transclude) {
return function(scope) {
transclude(scope.$parent, function(clone) {
tElement.html(clone.html());
});
@Ficik
Ficik / change_making_problem.rb
Last active December 31, 2015 08:19
ChangeMakingProblem solver
class ChangeMakingProblem
attr_reader :values, :target
def initialize(values)
# sorting is not nesesary, but has good impact on speed
@values = values.sort.reverse
end
def solve(target)
@Ficik
Ficik / monokai.sh
Created November 30, 2013 22:48
Monokai theme (colors as in sublime-text-2) for guake and gnome-terminal. Just copypaste to terminal
# Guake:
COLORS="#272728282222:#ffff29292929:#a6a6e2e22e2e:#e6e6dbdb7474:#6666d9d9efef:#f9f926267272:#bebe8484ffff:#fefefffffefe:#757571715e5e:#ffff29292929:#a6a6e2e22e2e:#fdfd97971f1f:#6666d9d9efef:#f9f926267272:#aeae8181ffff:#fefefffffefe"
FOREGROUND="#F6F6F5F5EEEE"
BACKGROUND="#232325252626"
gconftool-2 -s -t string /apps/guake/style/background/color $BACKGROUND
gconftool-2 -s -t string /apps/guake/style/font/palette $COLORS
gconftool-2 -s -t string /apps/guake/style/font/color $FOREGROUND
@Ficik
Ficik / gist:5280871
Last active December 15, 2015 15:19
w20-6-atompub
<?xml version="1.0" ?>
<app:service
xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:metadata="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:data="http://schemas.microsoft.com/ado/2007/08/dataservices">
<app:workspace href="http://store.it/users/432/albums/">
<title>Peter Novak's albums</title>
<app:collection href="http://store.it/users/432/albums/635/">
<title>Trip to Prague></title>
@Ficik
Ficik / gist:5232332
Last active December 15, 2015 08:39
w20-cv5
http = require "http"
crypto = require "crypto"
hash = (text) -> crypto.createHash("md5").update(text).digest("hex")
all = (array, fn) ->
for value in array
return false unless fn(value)
return true
any = (array, fn) ->
for value in array
@Ficik
Ficik / gist:5194162
Created March 19, 2013 06:44
w20-cv3
storage =
books:
1:
"name" : "Nazev"
"isbn" : "123556"
"publisher" : "/publisher/1"
"author" : "/author/2"
2:
"name" : "Nazev"
"isbn" : "123556"