Skip to content

Instantly share code, notes, and snippets.

View drguildo's full-sized avatar

Simon Morgan drguildo

View GitHub Profile
@drguildo
drguildo / gist:e46ccd87e5b9237b9e72
Created August 21, 2014 17:05
"lein repl" Exception
Exception in thread "nREPL-worker-0" java.lang.NoSuchMethodError: clojure.tools.nrepl.StdOutBuffer.length()I
at clojure.tools.nrepl.middleware.session$session_out$fn__7630.doInvoke(session.clj:43)
at clojure.lang.RestFn.invoke(RestFn.java:460)
at clojure.tools.nrepl.middleware.session.proxy$java.io.Writer$ff19274a.write(Unknown Source)
at java.io.PrintWriter.write(Unknown Source)
at java.io.PrintWriter.write(Unknown Source)
at clojure.core$fn__5471.invoke(core_print.clj:191)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at clojure.core$pr_on.invoke(core.clj:3392)
at clojure.core$pr.invoke(core.clj:3404)
@drguildo
drguildo / gist:f98d3e44270a541a9d45
Last active August 29, 2015 14:06
Useful Eclipse Shortcuts
Shortcut Description
Ctrl + 3 Opens a filterable list of all available actions.
Ctrl + D Delete the current line.
Ctrl + L Go to line.
Ctrl + O Gives an outline of the code allowing quick navigation between definitions.
Ctrl + / Toggles commenting of the selected region or the current line.
Ctrl + F11 Runs the current code.
Ctrl + Shift + F Format the selected code or the current file.
@drguildo
drguildo / gist:8c429c8557b373826dd5
Created September 20, 2014 12:28
Fletcher's checksum in Kotlin
package com.drguildo.stdlib.algorithms
fun fletcher16(data: ByteArray): Int {
var sum1 = 0
var sum2 = 0
for (d in data) {
sum1 = (sum1 + d) % 255
sum2 = (sum2 + sum1) % 255
}

Keybase proof

I hereby claim:

  • I am drguildo on github.
  • I am drguildo (https://keybase.io/drguildo) on keybase.
  • I have a public key whose fingerprint is 8ACF 5D22 C3CE 5B92 7288 51A2 A848 A3BA D352 170C

To claim this, I am signing this object:

@drguildo
drguildo / doge-value.py
Created October 26, 2014 15:19
Ð Value Checker
import json
import string
import urllib2
data = urllib2.urlopen("http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=132")
doge = string.join(data.readlines())
doge = json.loads(doge)
doge = doge['return']['markets']['DOGE']
print(doge['lasttradetime'] + " " + doge['label'] + ": " + doge['lasttradeprice'])
@drguildo
drguildo / bentley-theme.el
Created April 23, 2015 22:17
Bentley Emacs Theme
;;; bentley-theme.el --- Emacs 24 theme with a dark background.
;; Copyright (C) 2014 , Simon Morgan <sjm@sjm.io>
;; Author: Simon Morgan <sjm@sjm.io>
;;
;; Version: 0.1
;; Package-Requires: ((emacs "24"))
;; Created with emacs-theme-generator, https://github.com/mswift42/theme-creator.
if (buffer.startsWith(" ")) {
String trimmed = buffer.trim();
matchStart += buffer.indexOf(trimmed.charAt(0));
buffer = buffer.substring(matchStart);
}
@drguildo
drguildo / main.rs
Created May 20, 2015 12:51
Abstract Syntax Tree
mod simple;
use simple::Expr::{Number, Add, Multiply};
fn main() {
println!("Let's compute!");
let e = Add(Box::new(Add(Box::new(Number(1)),
Box::new(Number(1)))),
Box::new(Multiply(Box::new(Number(2)),