Skip to content

Instantly share code, notes, and snippets.

View skazhy's full-sized avatar

Kārlis Lauva skazhy

View GitHub Profile
@skazhy
skazhy / _latest_posts.html
Created April 5, 2012 09:01
Django templatetags example
ul>
{% for p in posts %}
<li><a href="{{ a.url }}">{{ a.title }}</a>
{% endfor %}
</ul>
@skazhy
skazhy / views.py
Created August 12, 2013 12:05
reverse_angular_url for Tornado
import tornado.web
class BaseHandler(tornado.web.RequestHandler):
def reverse_angular_url(self, name, *args):
# Works like regular reverse_url but replaces regex groups
# with :arg, so it can fit nicely in the AngularJS router
# for given route named "employee" "/company/(.*)/employees/(.*)$" ->
# reverse_angular_url("employee", "company_id", "employee_id")
# returns "/company/:company_id/employees/:employee_id"
@skazhy
skazhy / payload.xml
Last active March 15, 2022 05:47
Configuration profile example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadIdentifier</key>
<string>com.fullcontact</string>
<key>PayloadType</key>
<string>Configuration</string>
@skazhy
skazhy / build.sbt
Last active August 29, 2015 13:57
mocking scala-redis RedisClientPool
name := "foo"
version := "1.0"
libraryDependencies ++= Seq(
"net.debasishg" % "redisclient_2.10" % "2.12",
"org.specs2" %% "specs2" % "2.3.10" % "test",
)
@skazhy
skazhy / keybase.md
Last active August 29, 2015 14:13
keybase.md

Keybase proof

I hereby claim:

  • I am skazhy on github.
  • I am skazhy (https://keybase.io/skazhy) on keybase.
  • I have a public key whose fingerprint is EF9B F9E8 90F7 A325 D409 215D 432B D41F 835B 3C81

To claim this, I am signing this object:

@skazhy
skazhy / keybase.md
Created January 11, 2015 17:16
keybase.md

Keybase proof

I hereby claim:

  • I am skazhy on github.
  • I am skazhy (https://keybase.io/skazhy) on keybase.
  • I have a public key whose fingerprint is EF9B F9E8 90F7 A325 D409 215D 432B D41F 835B 3C81

To claim this, I am signing this object:

@skazhy
skazhy / core.clj
Last active August 29, 2015 14:18
minimal async sqs
(ns bandarlog.core
(:require [clojure.core.async :refer [thread-call <!! thread go <!]])
(:import com.amazonaws.auth.BasicAWSCredentials
com.amazonaws.services.sqs.AmazonSQSAsyncClient
com.amazonaws.services.sqs.buffered.AmazonSQSBufferedAsyncClient
(com.amazonaws.services.sqs.model SendMessageRequest
SendMessageBatchRequest
SendMessageBatchRequestEntry
ReceiveMessageRequest
ReceiveMessageResult)))
@skazhy
skazhy / gist:98192577368a69f6b7e3
Created August 20, 2015 19:53
eastwood-go-trace
Exception thrown during phase :analyze+eval of linting namespace test
IllegalArgumentException No method in multimethod '-item-to-ssa' for dispatch value: :with-meta
clojure.lang.MultiFn.getFn (MultiFn.java:156)
clojure.lang.MultiFn.invoke (MultiFn.java:229)
clojure.core.async.impl.ioc-macros/item-to-ssa (ioc_macros.clj:492)
clojure.core.async.impl.ioc-macros/fn--3592/fn--3595 (ioc_macros.clj:600)
clojure.core.async.impl.ioc-macros/parse-to-state-machine/fn--3798 (ioc_macros.clj:802)
clojure.core.async.impl.ioc-macros/get-plan (ioc_macros.clj:80)
clojure.core.async.impl.ioc-macros/parse-to-state-machine (ioc_macros.clj:802)
clojure.core.async.impl.ioc-macros/state-machine (ioc_macros.clj:1067)
@skazhy
skazhy / conj15.md
Created November 18, 2015 21:20
Conj 2015 notes + links

clojure/conj 2015 notes

All of the talks are on YouTube. Conj 2015 on Lanyrd.

Clojure

State machines for Clojure

@skazhy
skazhy / kwatargs.clj
Created October 5, 2016 20:29
argument map vs argument list
(defn arg-map [{:keys [foo]}] foo)
(arg-map {:foo 1}) ; 1
(arg-map {:foo 1 :foo 2}) ; Compiler Exception
; apply hash-map is executed internally, so fun things happen:
(defn kwargs [& {:keys [foo]}] foo)
(kwargs :foo 1) ; => 1
(kwargs :foo 1 :foo 2) ; => 2