Skip to content

Instantly share code, notes, and snippets.

View prio's full-sized avatar

Jonathan Harrrington prio

View GitHub Profile
(ns notepad.core
(:require [dommy.utils :as utils]
[dommy.core :as dommy])
(:use-macros [dommy.macros :only [node deftemplate]])
(:import [goog.ui Zippy]))
(defn create-note [item el]
(let [data (js->clj item)]
{:title (data "title") :content (data "content") :parent el}))
@prio
prio / core.cljs
Last active December 28, 2015 18:58
Port of flpjax example to core.async
(ns calc.core
(:require [dommy.core :as dom]
[cljs.core.async :refer [>! <! chan put!]])
(:require-macros [cljs.core.async.macros :refer [alt! go-loop]])
(:use-macros [dommy.macros :only [sel sel1]]))
(defn setup [id]
(let [el (sel1 id)
out (chan)
@prio
prio / server.ex
Created January 6, 2014 22:16
Elixir gen_server example
defmodule Tcprpc.Server do
use GenServer.Behaviour
defrecord State, port: nil, lsock: nil, request_count: 0
def start_link(port) do
:gen_server.start_link({ :local, :tcprcp }, __MODULE__, port, [])
end
def start_link() do
@prio
prio / do-package.mk.diff
Created April 23, 2014 08:12
Add UPSTREAM_TAG support to rabbitmq-public-umbrella
--- a/do-package.mk Tue Apr 15 13:11:24 2014 +0100
+++ b/do-package.mk Wed Apr 23 09:12:18 2014 +0100
@@ -233,6 +233,7 @@
# Work around weird github breakage (bug 25264)
cd $(CLONE_DIR) && git pull
$(if $(UPSTREAM_REVISION),cd $(CLONE_DIR) && git checkout $(UPSTREAM_REVISION))
+ $(if $(UPSTREAM_TAG),cd $(CLONE_DIR) && git checkout tags/$(UPSTREAM_TAG))
$(if $(WRAPPER_PATCHES),$(foreach F,$(WRAPPER_PATCHES),patch -d $(CLONE_DIR) -p1 <$(PACKAGE_DIR)/$(F) &&) :)
touch $$@
endif # UPSTREAM_GIT
@prio
prio / package.mk.diff
Created April 23, 2014 08:14
Add UPSTREAM_TAG to elixir_wrapper make file
--- a/package.mk
+++ b/package.mk
@@ -3,6 +3,7 @@ DO_NOT_GENERATE_APP_FILE:=true
UPSTREAM_GIT:=git://github.com/elixir-lang/elixir.git
UPSTREAM_REVISION:=master
+UPSTREAM_TAG:=v0.12.0
RETAIN_ORIGINAL_VERSION:=true
ORIGINAL_APP_FILE=$(CLONE_DIR)/src/$(APP_NAME).app.src
@prio
prio / insert_data.sql
Last active May 17, 2016 23:02
Film Data File For Blog
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
@prio
prio / gist:314831f9794f351b0ba2
Created March 26, 2015 14:08
Clojure Verticle Error
Unexpected exception in Clojure verticle
java.lang.RuntimeException: No such var: eb/on-message, compiling:(clojure/YYYY/XXXX.clj:62:1)
at clojure.lang.Compiler.analyze(Compiler.java:6464)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3665)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6646)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5782)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5217)
@prio
prio / Scheduler.ex
Last active August 29, 2015 14:23
get_best_pid
defmodule Scheduler do
def get_best_pid(group) do
mems = :pg2.get_members(group) |>
Enum.map(fn(pid) ->
[message_queue_len: msgs, stack_size: ss] = :rpc.pinfo(pid, [:message_queue_len, :stack_size])
{pid, msgs, ss}
end) |>
Enum.sort(fn ({_, q1, s1}, {_, q2, s2}) -> q1 < q2 or (q1 == q2 and s1 < s2) end)
case mems do
[{pid, _, _} | _] -> pid
-module(czmq_const).
-compile(export_all).
-include_lib("czmq/include/czmq.hrl").
zmq_pair() ->
?ZMQ_PAIR.
zmq_pub() ->
?ZMQ_PUB.
@prio
prio / index.ts
Created May 5, 2021 19:29
An example of a left side panel extension for Jupyterlab.
import {
JupyterFrontEnd,
JupyterFrontEndPlugin,
ILabShell
} from '@jupyterlab/application';
import { Widget } from '@lumino/widgets';
/**
* Initialization data for the jupyterlab-sidepanel extension.