Skip to content

Instantly share code, notes, and snippets.

(* Fsharp files must contain a module definition, which is equivalent to a namespace *)
module FsharpHighlights
#light
(* The open statement is equivalent to c#'s using and vb's imports *)
open System
(* Functions are first class citizens ;D *)
let square x = x * x
let numbers x = [1..x]
public class ClassWithMethodMissing : DynamicObject {
public override bool TrySetMember(SetMemberBinder binder, object value) {
_dictionary[binder.Name] = value;
return true;
}
public override bool TryGetMember(GetMemberBinder binder,
out object result) {
return _dictionary.TryGetValue(binder.Name, out result);
}
@rranelli
rranelli / clone_repos.rb
Last active August 29, 2015 14:03
Clone all your gitrepos
#!/usr/bin/env ruby
require 'net/http'
require 'json'
include Process
def get_all_repos_from_user(username, protocol = 'ssh')
repos = get_response(username)
get_urls(repos, protocol)
# -*- restclient -*-
:token := "<your secret private token>" # This is the gitlab authentication token
# Groups
:page := 1
GET https://<gitlabhost>/api/v3/groups?private_token=:token&page=:page
# Group
:group := 42
***** Ideas from [[http://vimeo.com/91672848][this talk]]:
In the small, its easy to apply solid and stuff.
How should we be using this ?????
=> its terribly easy to write procedural code using object oriented languages.
=> OO is a method to:
control the intellectual load of understand our systems.
extensible, reusable, simpler
@rranelli
rranelli / braindump-7langs-7weeks.org
Created March 2, 2015 23:42
braindump-7langs-7weeks

Talk

Why is it important to learn new languages ?

<Image of the pragmatic programmer book>. You should learn a new language every year because they bend your mind and teach you new ways too solve old problems.

Also, the fact of the language being new is not actually all that important. What is important is that the language has another paradigm and another way o seeing the world.

#!/usr/bin/env bash
set -euo pipefail # these don't play well with bashdb;
#
## Setup environment
#
: ${GITHUB_USER:=rranelli}
: ${GITHUB_API_TOKEN:=$(mimipass get github-api-token)}
: ${CODE_DIR:=$HOME/code}
#!/bin/sh
# this script is intended to run on a debian8 box
set -e
USERNAME=user
_prep () {
apt-get update
defmodule LuklaWeb.AsyncQueue do
use GenServer
alias LuklaWeb.Repo
alias LuklaWeb.AsyncQueue.Job
@reconnect_interval_millis 5000
def start_link() do
GenServer.start_link(__MODULE__, [], name: AsyncQueue)
12:38:38.964 [info] Running LuklaWeb.Endpoint with Cowboy using http on port 4000
Interactive Elixir (1.2.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 12:38:42.771 [error] Disconnected from Redis (localhost:6379): :tcp_closed
12:38:42.776 [error] Error connecting to Redis (localhost:6379): connection refused
12:38:42.780 [error] Error connecting to Redis (localhost:6379): connection refused
12:38:42.792 [error] Error connecting to Redis (localhost:6379): connection refused
12:38:42.803 [error] Error connecting to Redis (localhost:6379): connection refused
12:38:42.813 [error] Error connecting to Redis (localhost:6379): connection refused
12:38:42.818 [error] Error connecting to Redis (localhost:6379): connection refused
12:38:42.824 [error] Error connecting to Redis (localhost:6379): connection refused