Skip to content

Instantly share code, notes, and snippets.

@pbostrom
pbostrom / cljs-npm.md
Last active March 8, 2024 07:53
Loading third-party npm modules in ClojureScript

Loading third-party npm modules in ClojureScript

This example shows how to load the re-resizable npm module which provides a resizable React component. Requires the lein-npm plugin.

  1. Add the npm module to the :npm :dependencies section of project.clj:
 :npm {:package {:scripts {:build "webpack -p"}}
       :dependencies [[react "16.4.0"]
                      [react-dom "16.4.0"]
                      ["@cljs-oss/module-deps" "1.1.1"]
(ns noise.gen
(:require [ionsails.noise.perlin :as perlin]))
(defn get-range
([width]
(for [x (range width)]
(vector x)))
([width height]
(for [y (range height)
x (range width)]
@gaearon
gaearon / slim-redux.js
Last active March 25, 2024 19:12
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
Clojure Developer for Malware Analysis Product
The ThreatGRID team at Cisco is looking for experienced clojure
developers to work on our large scale, malware analysis product. Our
entire platform is built on Clojure, from the Clojurescript UI,
through the API services, around the event processing subsystem, and
down to the core.logic analysis engine.
Our system runs as a distributed cluster in the cloud, and shrunk
down to a single on-premises appliance. This keeps us focused on
@thomasboyt
thomasboyt / loading.md
Created October 22, 2014 15:09
Flux loading state pattern

I've been struggling to come up with a good pattern for handling loading state in Flux (specifically using Fluxxor, though I think this is an issue for any implementation).

When I say "loading state," what I mean is state in a store that tracks:

  • Whether the data handled by the store was loaded
  • Whether the store is currently attempting to load data
  • Whether the data loaded successfully or errored
  • The error message, if it errored

Here's my first (very simple) pass at this, a store mixin called LoadingStoreMixin.js:

var Dialog = React.createClass({
render: function() {
// 1) render nothing, this way the DOM diff will never try to do
// anything to it again, and we get a node to mess with
return React.DOM.div();
},
componentDidMount: function() {
// 2) do DOM lib stuff
this.node = this.getDOMNode();
Turning The Design Clock Back
Object-oriented design principles haven't had the effect we hoped for. The
SOLID principles are excellent design guidelines, but experience shows that
programmers find them difficult to follow. What do we do about this?
Surprisingly, the Structured Design literature of forty years ago contains
compelling solutions to many current design problems. They're simple and easy
to understand, but were lost in the noise as OO rose to popularity. We'll
reinterpret these simple design ideas in a modern context, finding that many of
our most promising new design ideas resemble them. Rapid web application

Reciprocal Needs in the Employment Relation

We can look at two sides of the management coin: What do the individuals get out of it? And what benefit does the whole system derive from it?

I will disregard any benefits that accrue to managers just by holding the position of managing. Those are just circular logic. Circular logic abounds in discussions of management and hierarchy. For example, consider status reports. It will be said that status reports are necessary so managers know what their employees are working on. It’s

@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t