Skip to content

Instantly share code, notes, and snippets.

Tom Crinson MrJaba

Block or report user

Report or block MrJaba

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
MrJaba / tmp2.clj
Last active Aug 29, 2015
Various 4Clojure Problems
View tmp2.clj
(ns tmp2)
(def data [1 1 2 3 2 1 1])
(def data2 [1 2 1 3 1 2 4])
( #(reduce (fn [acc el]
(if-not (some #{el} acc)
(conj acc el)
MrJaba / programming-resources.txt
Created Jun 19, 2014
List of interesting programming resources
View programming-resources.txt
Ruby Rogues -
Ruby5 -
FunctionalGeekery -
Destroy all software -
Ruby Tapas -
MrJaba / destructuring.clj
Created Jan 20, 2013
Clojure Destructuring Examples
View destructuring.clj
;; Anything you type in here will be executed
;; immediately with the results shown on the
;; right.
(def name ["Tom" "David" "Crinson"])
(str (nth name 2) ", "
(nth name 0) " "
(nth name 1))
$- >
initializeLinkSearch = ->
$("#search").keyup ->
displayLinksMatching searchTerm()
resetLinks = ->
links = $('.links li a')
MrJaba / jdbc_tap.clj
Created Jul 5, 2012
Cascalog JDBCTap Example
View jdbc_tap.clj
(defn query-params []
(into-array String ["?col1" "?col2"]))
(defn column-names []
(into-array String ["col1" "col2"]))
; Becomes the 'where' part of the UPDATE statement - use primary key for example
(defn update-params []
(into-array String ["?col1"]))
View db_tap.clj
(ns paduka.db_tap
(:use cascalog.api)
(:require [cascalog [vars :as v] [ops :as c] [workflow :as w]]
[clojure.string :as s])
(:import [com.twitter.maple.jdbc JDBCScheme JDBCTap TableDesc]
[cascading.tuple Fields])
(defn mysql-tap []
(let [scheme (JDBCScheme. (Fields. (into-array String ["id" "screen_name" "content"])) (into-array String ["id" "screen_name" "content"]))
MrJaba / module_wrapper.rb
Created Jun 12, 2012
Wrapping a class method by including a module
View module_wrapper.rb
module Wrapper
def self.included(base)
base.extend ClassMethods
module ClassMethods
def wrap!
class << self
MrJaba / Rakefile
Created Jun 3, 2012
jRuby Rake file trap test
View Rakefile
desc "Show off odd trap behaviour"
task :trap do
trap("INT") { puts "trapped INT"; exit(true) }
at_exit { puts "here" }
puts "sleeping"
sleep 10
MrJaba / test.rb
Created Apr 25, 2012
JRuby oddness?
View test.rb
# jruby 1.6.7 (ruby-1.9.2-p312)
require 'open-uri'
a = open("").read
=> #<Encoding:UTF-8>
b =
=> #<Encoding:ASCII-8BIT>
View gist:2006079 (Bytes.toBytes('data'), Bytes.toBytes('followers_count'), CompareFilter::CompareOp.valueOf('GREATER_OR_EQUAL'),
You can’t perform that action at this time.