Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am nblumoe on github.
  • I am nblumoe (https://keybase.io/nblumoe) on keybase.
  • I have a public key ASBt8Y9xnzleLaIOwXoCP4YaZ9d8GbID1i0iV6k4ONcS9go

To claim this, I am signing this object:

;; example for novelty:
{:user/verify {:db/id 1234 :being-verified false :verification-error :credentials-invalid}}
(defn merge-tree [old-state novelty]
(cond
(:user/verify novelty)
(let [novelty-props (:user/verify novelty)]
(update-in old-state [:users/by-id (:db/id novelty-props)] merge (dissoc novelty-props :db/id)))
;;;; WORKS
(defui User
static om/IQuery
(query [this]
[:user/name :user/status])
Object
(render [this]
;; ....
))
@nblumoe
nblumoe / core.clj
Last active September 21, 2015 18:44
Example code for the problem of removing items from lazy sequences nested in a large Clojure tree and related issues. See http://stackoverflow.com/questions/32667778/removing-elements-from-lazy-sequences-in-a-large-clojure-tree-structure-avoidin for details
(ns large-tree.core
"Working example, also using XML."
(require [clojure.data.xml :as xml]))
(defn root' [content]
(fn []
(xml/map->Element {:tag :root :content (content)})))
(defn lazy-elements' [n tag content]
(repeatedly n (fn [] (xml/map->Element {:tag tag :content (content)}))))
@nblumoe
nblumoe / oc_backup.sh
Created June 7, 2015 08:47
ownCloud backup script
#!/bin/bash
# database
mysqldump --lock-tables -h localhost -u owncloud -p owncloud > owncloud-sqlbkp_`date +"%Y%m%d"`.bak
# directory
rsync -Aax /var/www/owncloud/ owncloud-dirbkp_`date +"%Y%m%d"`/
@nblumoe
nblumoe / gist:b7667ce2072f0d811196
Created April 19, 2015 06:37
piggieback issue when using cljs-time with boot
$ boot dev
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
** WARNING: ~/.profile.boot is deprecated.
** Please use $BOOT_HOME/profile.boot instead.
** See: https://github.com/boot-clj/boot/issues/157
Writing boot_cljs_repl.cljs...
<< started reload server on ws://localhost:47769 >>
Writing boot_reload.cljs...
2015-04-19 08:36:10.786:INFO:oejs.Server:jetty-7.6.13.v20130916
2015-04-19 08:36:10.806:INFO:oejs.AbstractConnector:Started [email protected]:3000
add_filter('widget_posts_args','exclude_posts_abtests_variants');
function exclude_posts_abtests_variants( $args ){
// IDs von Beitragsvarianten
$args['post__not_in']= array(123,345);
return $args;
}
(ns create-draw.opencv
(:import
org.opencv.core.Core
org.opencv.core.Mat
org.opencv.core.MatOfRect
org.opencv.core.Point
org.opencv.core.Rect
org.opencv.core.Scalar
org.opencv.highgui.Highgui
org.opencv.objdetect.CascadeClassifier))
@nblumoe
nblumoe / vim_fireplace_paredit_cheat_sheet.md
Created April 24, 2013 06:41
Simple cheat sheet for vim fireplace and paredit

fireplace

  • cpr => (require ... :reload)
  • cpR => (require ... :reload-all)

Evaluation

  • :Eval (clojure code) => runs (clojure code) in repl
  • cpp => evaluate inn-most expessions under cursor
  • cp<movement> => evaluate text described by <movement>
  • cqp => opens quasi-repl
  • cqc => quasi-repl command line window
@nblumoe
nblumoe / angularjs_resource_tokenhandler.js
Created July 5, 2012 07:34
AngularJS service to send auth token with $resource requests
.factory('TokenHandler', function() {
var tokenHandler = {};
var token = "none";
tokenHandler.set = function( newToken ) {
token = newToken;
};
tokenHandler.get = function() {
return token;