Skip to content

Instantly share code, notes, and snippets.

View podviaznikov's full-sized avatar
🗽
NYC, hacking, thinking, observing, feeling

anton podviaznikov

🗽
NYC, hacking, thinking, observing, feeling
View GitHub Profile
@nnarhinen
nnarhinen / deploy.bash
Last active December 31, 2015 12:28
My deployment script to pull and run a docker-contained clojure web application
id=$(docker ps | grep myimage:latest | awk '{ print $1 }')
docker pull quay.io/nnarhinen/myimage
new_id=$(docker run -d -p 3000 \
-e ENVIRONMENT=PRODUCTION quay.io/nnarhinen/myimage)
id=$new_id ./update-nginx-port.bash
docker stop $id
@greenido
greenido / IndexDB-demo3.html
Created June 24, 2011 22:34
IndexDB demo for MDC day (Chrome 12+ and FF4+)
<!DOCTYPE html>
<html>
<head>
<title>IndexDB Demo - Version 1.1</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="author" content="Ido Green"/>
</head>
<style>
#footer {
background-color: yellowgreen;
@danielsz
danielsz / pushState.cljs
Last active July 15, 2016 15:13
PushState (via Html5History from google closure) with secretary, a client-side routing library for clojurescript. Allows to map absolute urls with routes without the hash-bang hackery.
(def history (Html5History.))
(.setUseFragment history false)
(.setPathPrefix history "")
(.setEnabled history true)
(let [navigation (listen history EventType/NAVIGATE)]
(go
(while true
(let [token (.-token (<! navigation))]
(secretary/dispatch! token)))))
@almccon
almccon / Parisoma_Workshop_January_2015.md
Last active November 2, 2016 23:13
Parisoma workshop January 2015: Things to download
@adamalex
adamalex / .ebextensions--eb.config
Created October 28, 2013 00:01
Config and CI script for automated Node.js 0.10.10 project deployment—including grunt—to Elastic Beanstalk
packages:
yum:
git: []
gcc: []
make: []
openssl-devel: []
commands:
00-add-home-variable:
command: sed -i 's/function error_exit/export HOME=\/root\n\nfunction error_exit/' /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh
container_commands:
FROM debian:wheezy
ENV DEBIAN_FRONTEND noninteractive
# Oracle Java 8
RUN apt-get update \
&& apt-get install -y wget openssl ca-certificates \
&& cd /tmp \
&& wget -qO jdk8.tar.gz \
@nnja
nnja / nina.zsh-theme
Last active February 23, 2017 00:47
My zshell prompt theme, a bastardization of robbyrussel & kolo themes
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats '%c%u%B%F{green} '
@jtmarmon
jtmarmon / gist:0a644fbca15a1742964c
Created May 25, 2015 20:56
Convert datomic entity map into clojure map
(defn emap-to-hash-map [e]
(cond
(or
(-> e class .toString (clojure.string/split #" ") second (= "datomic.query.EntityMap"))
(map? e)) (reduce-kv (fn [m k v] (assoc m k (emap-to-hash-map v))) {} (into {} e))
(coll? e) (map emap-to-hash-map e)
:else e))
@pelle
pelle / accounts.clj
Created May 8, 2012 14:37
Using database functions in Datomic transactions and annotating transaction history
(use '[datomic.api :only [q db] :as d])
(def uri "datomic:mem://accounts")
;; create database
(d/create-database uri)
;; connect to database
(def conn (d/connect uri))
@caged
caged / d3-multi-line.js.coffee
Created December 30, 2011 17:23
d3.js line chart with multiple lines and points
$ ->
version = Number(document.location.hash.replace('#', ''))
data = [[3,7,9,1,4,6,8,2,5], [5,2,3,4,9,6,4,6,8]]
[pt, pl, pr, pb] = [20, 20, 20, 20] # padding
w = 800 - (pl + pr)
h = 300 - (pt + pb)
max = d3.max(data, (d) -> d3.max(d))
# Scales
x = d3.scale.linear().domain([0, data[0].length - 1]).range [0, w]