Skip to content

Instantly share code, notes, and snippets.

View rundis's full-sized avatar

Magnus Rundberget rundis

View GitHub Profile
@rundis
rundis / gist:145cfdaf6ea277c9647b
Created June 8, 2015 08:25
FixedDataTable with cellRenderer throws when using dev version of react
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://rawgit.com/facebook/fixed-data-table/5e72a326c16b667ec6f38cb47147c74daeaaf956/dist/fixed-data-table.css">
</head>
<div id="content"></div>
<body>
<!-- The none minified version of react throws:
@rundis
rundis / gist:77237558ca31aa5af5bf
Created April 23, 2015 10:23
Failed sexpr finder
(ns parser
(:require [clojure.tools.reader :as reader]
[clojure.tools.reader.reader-types :as rt]
[clojure.zip :as zip]))
(defn try-read [rdr]
(when rdr
(reader/read rdr false ::EOF)))
@rundis
rundis / gist:521420edd12027bf4d6d
Created April 11, 2015 23:05
refactor-nrepl: find-unbound weird results
(ns acme-auth.store
(:require [clojure.java.jdbc :as jdbc]))
(defn add-user! [ds user]
(jdbc/with-db-transaction [conn ds]
(let [res (jdbc/insert! conn
:user
{:username (:username user) :password (:password user)})
user-id ((keyword "scope_identity()") (first res))]
@rundis
rundis / gist:b035bfd058b419f782e5
Last active August 29, 2015 14:18
Find unbound weirdness
(ns acme-auth.store
(:require [clojure.java.jdbc :as jdbc]))
(defn- find-user-roles [conn user-id]
(let [id (jdbc/query conn "select sysdate from dual")]
(map (fn [row] {:role-id (:id row) :application-id (:application_id row)})
(jdbc/query conn ["select r.id, r.application_id
from role r
inner join user_role ur on r.id = ur.role_id
where ur.user_id = ?" user-id]))))
@rundis
rundis / gist:2bd8954059af6bb8175a
Last active August 29, 2015 14:17
nrepl find symbol extra space ?
;given store.clj with a function like
(defn find-user-by-id3 [conn id]
(when-let [user
(first
(jdbc/query conn ["select * from user where id = ?" id]))]
(assoc user :user-roles (find-user-roles conn (:id user)))))
; and a service.clj with a usage like
(defn refresh-auth-token [ds auth-conf refresh-token]
(if-let [unsigned (unsign-token auth-conf refresh-token)]
@rundis
rundis / gist:d2213fa2e3df98196e47
Created January 16, 2015 08:54
Gradle SSH Env Example
buildscript {
repositories { jcenter() }
dependencies { classpath 'org.hidetake:gradle-ssh-plugin:0.1.7' }
}
apply plugin: 'ssh'
remotes {
test {
host = '192.168.255.1'
@rundis
rundis / gist:4979604
Created February 18, 2013 18:43
Sample workaround to get (troublesome ? ) classes into the gradle buildscript classpath
// what i want
// buildscript { classpath 'com.oracle:ojdbc6:11.2.0.2.0' }
configurations {
gradleRuntime {transitive = false}
}
dependencies {