Skip to content

Instantly share code, notes, and snippets.

@raol
raol / Actors.fs
Created August 1, 2016 14:40
Actor configuration example
module Actors
open System
open System.Threading.Tasks
let inline response(data:obj) = Task.FromResult(data)
let inline taskDone() = Task.FromResult(null) :> Task
type BodyConfiguration<'TMessage> = {
@raol
raol / 0_reuse_code.js
Created June 25, 2014 11:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@raol
raol / hidepreview.css
Last active December 27, 2015 08:59
Hide image preview from twitter feed css. On click image is shown.
@-moz-document url-prefix(https://twitter.com) {
ol#stream-items-id > li.stream-item > div.tweet div.cards-media-container {
display: none;
}
}
@raol
raol / volume.py
Created October 31, 2013 11:22
Calculates filled gaps between pikes
def calculate_volume(terrain):
if len(terrain) < 3: return 0
lmax = 0
rmax = 0
left = 0
right = len(terrain) - 1
volume = 0;
while left < right:
if terrain[left] > lmax:
lmax = terrain[left]
@raol
raol / rounding.txt
Created October 21, 2013 17:32
Math rounding with ceilings
rounded = ceiling(x) + ceiling(2 * (x - ceiling(x)))
@raol
raol / Typescript.sublime-build
Last active December 26, 2015 02:49
Finally created Typescript build system for sublime
{
"cmd": ["tsc", "--target", "ES5", "$file"],
"selector": "source.ts",
"file_regex" : "^(.+?)\\((\\d+),(\\d+)\\):\\s*(.+)$",
"line_regex": "\\((\\d+),(\\d+)\\)"
}
@raol
raol / binarysearch.py
Last active December 24, 2015 21:38
Binary search sample
def binarysesarch(x, a):
""" binarysesarch implementation
>>> binarysesarch(1, [1])
0
>>> binarysesarch(1, [])
-1
>>> binarysesarch(2, [1])
-1
>>> binarysesarch(1, [0, 1, 1, 2])
1
sort = sorted(values)
final = []
current = [sort[0]]
for i in range(1, len(sort)):
if sort[i] == sort[i - 1] + 1:
current.append(sort[i])
else:
final.append(current)
current = [sort[i]]
final.append(current)