Skip to content

Instantly share code, notes, and snippets.

start_deps(X) when not is_list(X) ->
start_deps([X]);
start_deps([]) ->
ok;
start_deps([A|T]) ->
case application:ensure_started(A) of
ok ->
start_deps(T);
@maximvl
maximvl / gist:27fcbd8c5f82c9925342
Created August 21, 2014 20:25
julia repl crash
julia> type(Union)
()
end
Warning: imported binding for Union overwritten in module Main
julia> Union()
ERROR: `Union` has no method matching Union()
@maximvl
maximvl / gist:812144897361179bfc24
Last active August 29, 2015 14:05
typing problems with consonants array
const vovels = ['a', 'o', 'e', 'u', 'y', 'i']
const consonants = filter(x -> x != nothing,
[i in vovels ? nothing : i
for i in 'a':'z'])
const vrx = Regex("[$(convert(String, vovels))]{3}\$")
const crx = Regex("[$(convert(String, consonants))]{3}\$")
@maximvl
maximvl / t.jl
Last active August 29, 2015 14:05
temperature converter
module Tconverter
export convert
import Base.convert
abstract Temperature
type Celsius <: Temperature
value :: Real
end
MemTotal: 5801372 kB
MemFree: 2391956 kB
Buffers: 774192 kB
Cached: 1015376 kB
SwapCached: 0 kB
Active: 1327312 kB
Inactive: 753192 kB
Active(anon): 493284 kB
Inactive(anon): 77992 kB
Active(file): 834028 kB
@maximvl
maximvl / key.ml
Last active August 29, 2015 14:07
let lwt_call f =
let t1,w1 = Lwt.wait () in
Lwt.ignore_result
(let res = f () in
Lwt.wakeup w1 res;
Lwt.return_unit);
t1
;;
let read_direction dir =
keyOrder = ['first_name', 'last_name', 'email', 'password1',
'password2', 'post', 'birthday', 'phone', 'city']
res = OrderedDict()
for key in keyOrder:
res[key] = self.fields.get(key)
self.fields = res
REBOL [
subject "FORTH interpreter"
]
forth: make object! [
stack: []
dup: [ 'dup (insert stack stack/1) ]
drop: [ 'drop (remove stack) ]
drop-n: [ 'drop-n (remove/part stack stack/1) ]
echo-protocol: make root-protocol [
port-flags: system/standard/port-flags/pass-thru
sys-copy: get in system/words 'copy
copy: func [ port /local reponse ] [
t1: now/time/precise
reponse: sys-copy ""
insert port/sub-port "hello"
read-io port/sub-port reponse 5
(now/time/precise - t1)
]
import strutils
import math
import os
import httpclient
import json
import tables
type
SlackChannel = ref SlackChannelObj
SlackChannelObj = object