Skip to content

Instantly share code, notes, and snippets.

View j1n3l0's full-sized avatar

Nelo Onyiah j1n3l0

  • Goznel Limited
  • Kent UK
  • 04:08 (UTC -12:00)
View GitHub Profile
@ray1729
ray1729 / gist:896702
Created March 31, 2011 16:30
Possible Regexp::Common API for Clojure
;; Perl: $RE{num}{-base => 2}{real}{-group => 3}{-sep => ','}
(re-seq (re :real {:base 2 :group 3 :sep \,} ) "1.345")
(defn parse-flags
"Parse a list of flags. Each flag name must be a keyword, and the
value must not be a keyword. If the value is omitted, true is
assumed. Returns a map.
e.g. (parse-flags [:i :j 1 :k \"two\"])
=> {:i true, :j 1, :k \"two\"}"
[flags]
(loop [flags (seq flags) accum {}]
(if flags
@j1n3l0
j1n3l0 / gist:2239353
Created March 29, 2012 16:25
loving lein2 dynamic dependencies :) #clojure #lein2 #pomegranate #quil
$ lein2 repl
Welcome to REPL-y!
Clojure 1.3.0
user=> (use '[cemerick.pomegranate :only (add-dependencies)])
nil
user=> (add-dependencies :coordinates '[[quil "1.0.0-SNAPSHOT"]])
ArtifactNotFoundException Could not find artifact quil:quil:jar:1.0.0-SNAPSHOT in central (http://repo1.maven.org/maven2/) org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap (WagonRepositoryConnector.java:946)
user=> (add-dependencies :coordinates '[[quil "1.0.0-SNAPSHOT"]] :repositories (merge cemerick.pomegranate.aether/maven-central {"clojars" "http://clojars.org/repo"}))
@lancew
lancew / gist:4001624
Created November 2, 2012 14:19
xmonad natural scrolling
echo "pointer = 1 2 3 5 4 7 6 8 9 10 11 12" > ~/.Xmodmap && xmodmap ~/.Xmodmap
@davegurnell
davegurnell / anorm.scala
Last active April 10, 2025 06:37
A short guide to Anorm
/*
Overview
--------
To run a query using anorm you need to do three things:
1. Connect to the database (with or without a transaction)
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator
3. Call one of the methods on `SqlQuery` to actually run the query
@davegurnell
davegurnell / TypeclassDemo.scala
Created October 6, 2015 14:53
Example of the type class pattern in Scala
object TypeclasseDemo {
// The parts of the type class pattern are:
//
// 1. the "type class" itself -- a trait with a single type parameter;
//
// 2. type class "instances" for each type we care about,
// each marked with the `implicit` keyword;
//
// 3. an "interface" to the type class -- one or more methods
dd if=~/Downloads/ubuntu-15.10-desktop-amd64.iso of=/dev/sdb && sync
@abstractart
abstractart / books.md
Last active May 26, 2025 16:54
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ
@davidmason
davidmason / install-watchman.bash
Created September 13, 2017 03:45
To install watchman on Fedora 26, these are all the hoops I had to jump through.
# The following packages are needed during `make`
# - openssl-devel so you don't get:
# ContentHash.cpp:13:10: fatal error: openssl/sha.h: No such file or directory
# - redhat-rpm-config so you don't get:
# gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
# - python-devel so you don't get:
# pywatchman/bser.c:31:10: fatal error: Python.h: No such file or directory
sudo dnf install openssl-devel redhat-rpm-config python-devel
# The rest is just instructions from