Skip to content

Instantly share code, notes, and snippets.

@maruks
maruks / dojo4.erl
Created July 21, 2015 22:17
July Hack Night
-module(dojo4).
-import(lists,[nth/2]).
-include_lib ("eunit/include/eunit.hrl").
-compile(export_all).
rand_list(Size) ->
lists:map(fun(X)-> random:uniform(100) end, lists:seq(1,Size)).
grid(Size) ->
lists:map(fun(X)-> rand_list(Size) end, lists:seq(1,Size)).
@non
non / answer.md
Last active February 28, 2025 11:46
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@pljones
pljones / Game.scala
Created April 21, 2015 21:36
West London Hack Night WLHN April 2015 Text Adventure
package adventure
import scala.collection.mutable.{ Map => MMap }
trait Direction
case object North extends Direction
case object South extends Direction
case object East extends Direction
case object West extends Direction
case object Wrong extends Direction
object scratch {
type SentenceAnagram = Set[String]
type SolutionSpace = Set[SentenceAnagram]
type CharacterCounts = Map[Char, Int]
def frequencyCount(word: String): CharacterCounts = {
val grouped: Map[Char, String] = word.toLowerCase.replaceAll("[^a-z]", "").groupBy(c => c)
grouped.map((pair: Tuple2[Char, String]) => (pair._1, pair._2.length))
}
@davegurnell
davegurnell / scala-dojo.scala
Created February 19, 2015 20:00
Notes on error handling and monads from London Scala Dojo on 19th February 2015
def userId(username: String): Option[Int] =
Some(1)
def mostRecentOrderId(userId: Int): Option[Int] =
Some(2)
def orderCost(orderId: Int): Option[Int] =
Some(3)
def mostRecentOrderCost(username: String): Option[Int] =
@CaffeinatedDave
CaffeinatedDave / Brainfuck.scala
Last active August 29, 2015 14:05
West London Hack Night - Brainfuck interpreter
object Compiler extends Application {
val program = "++++++++++" +
"[" +
">+++++++" +
">++++++++++" +
">+++" +
">+" +
"<<<<-" +
"]" +
@staltz
staltz / introrx.md
Last active May 12, 2025 23:22
The introduction to Reactive Programming you've been missing
@oroce
oroce / README.md
Created June 12, 2014 07:51
nginx request id
@mnd999
mnd999 / hacknight.c
Created May 15, 2014 06:54
West London hack night 14/5/14 - Bloom filter
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#define HASHMASK 0xFFFF
uint64_t hash(const char* key, uint64_t seed)
{
@Bouke
Bouke / gist:10454272
Last active September 22, 2023 17:23
Install FreeTDS, unixODBC and pyodbc on OS X

First, install the following libraries:

$ brew install unixodbc
$ brew install freetds --with-unixodbc

FreeTDS should already work now, without configuration:

$ tsql -S [IP or hostname] -U [username] -P [password]
locale is "en_US.UTF-8"

locale charset is "UTF-8"