Skip to content

Instantly share code, notes, and snippets.

View neilmock's full-sized avatar

Neil Mock neilmock

View GitHub Profile
(ns react-cljs.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [om.core :as om]
[om.dom :as dom :include-macros true]
[cljs.core.async :refer [>! <! chan put! sliding-buffer]]))
(enable-console-print!)
(def app-state
(atom {:counters (into [] (map (fn [n] {:id n :count 0}) (range 10)))}))
@darkone23
darkone23 / net.cljs
Last active May 11, 2021 12:12
websocket as a cljs core.async channel
(ns example.net
(:require [goog.net.WebSocket]
[goog.events :refer (listen)]
[cljs.core.async :as async :refer (chan <! >! put! close)]
[cljs.core.async.impl.protocols :as proto])
(:require-macros [cljs.core.async.macros :refer (go)]))
(defn ws
"WebSocket as a core.async channel
returns a channel which delivers the ws chan then closes"
anonymous
anonymous / nn.clj
Created March 24, 2013 16:55
A neural network in Titan and Clojure implementing the xor function
(ns martha.core
(:require [clojurewerkz.titanium.graph :as g]
[clojurewerkz.titanium.vertices :as v]
[clojurewerkz.titanium.edges :as e]
[clojurewerkz.titanium.types :as t]
[ogre.core :as q]))
(def conf {:storage {:backend "embeddedcassandra"
:hostname "127.0.0.1"
:keyspace "martha"
@avescodes
avescodes / Editing Clojure with Emacs
Last active July 5, 2022 13:32
Get started editing Clojure in Emacs with this basic config.
Check out README.md to get started editing Clojure with Emacs.
(ns plumbing.graph-async
(:require
[plumbing.fnk.pfnk :as pfnk]
[plumbing.fnk.schema :as schema]
[plumbing.core :as plumbing]
[plumbing.graph :as graph]))
;; async function has ^:async metadata, callback required key.
;; TODO: redo with just promises/futures once they have callback options
;; TODO: make nicer way to specify async fnks?
@radu-gheorghe
radu-gheorghe / copy_es_index.bash
Created November 5, 2012 09:30
copy one Elasticesarch index to another
#!/bin/bash
CURRENTINDEX="test"
NEWINDEX="newindex"
#where the indices are stored within the DATADIR
INDICESDIR=/var/lib/elasticsearch/elasticsearch/nodes/0/indices/
#get the metadata for the current index
curl localhost:9200/$CURRENTINDEX/_settings?pretty=true > /tmp/settings
curl localhost:9200/$CURRENTINDEX/_mapping?pretty=true > /tmp/mappings
@puffnfresh
puffnfresh / hipchat.el
Created November 2, 2012 15:34
HipChat + jabber.el
;; Connect using jabber-connect
;; My username from the HipChat configuration
;; from https://www.hipchat.com/account/xmpp
(setq jabber-account-list '(("10804_81219@chat.hipchat.com")))
;; To join HipChat rooms easily
(defvar hipchat-number "10804")
(defvar hipchat-nickname "Brian McKenna")
(defun hipchat-join (room)
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@jasonrudolph
jasonrudolph / 00-about.md
Created September 21, 2012 18:42
Rough Notes from Strange Loop 2012
@trey
trey / dropbox_git.md
Created May 18, 2012 03:12
Using Dropbox to Share Git Repositories

Using Dropbox to Share Git Repositories

First, create a Git subfolder inside your Dropbox folder. Then you can share the individual projects inside that folder with whomever you want (or just use it for instant offsite backups).

From inside a Git project:

git clone --bare . ~/Dropbox/Git/gitproject.git
git remote add dropbox ~/Dropbox/Git/gitproject.git

When you're ready to push: