Skip to content

Instantly share code, notes, and snippets.

View marivas's full-sized avatar

Manuel Rivas marivas

View GitHub Profile
@Khady
Khady / config.el
Last active February 27, 2023 12:25
OCaml and Reasonml emacs configuration
(use-package company
:ensure t
:custom
(company-quickhelp-delay 0)
(company-tooltip-align-annotations t)
:hook
((prog-mode utop-mode) . company-mode)
:config
(company-quickhelp-mode 1)
:bind
@favila
favila / datomic-reset-attributes.clj
Last active January 12, 2025 14:04
Datomic transaction functions to "reset" attributes: i.e. make them have a post-transaction value you specify without having to enumerate the retractions.
(def tx-fns
[{:db/ident :db.fn/reset-attribute-values
:db/doc "Transaction function which accepts an entity identifier, attribute identifier
and set of values and expands to any additions and retractions necessary to
make the final post-transaction value of the attribute match the provided
values. Attribute values must be scalars.
If multiple values are provided on a cardinality-one attribute you will get a
datom conflict exception at transaction time."
:db/fn (d/function
@wildermuthn
wildermuthn / datascript-subscription.cljs
Last active September 14, 2015 09:50
Experimenting with subscribing to datascript db updates in a way that at least loosely parallels a query.
(ns sb-db.experiments
(:require [datascript :as d]
[cljs.core.match :refer-macros [match]])
(:require-macros [sb.macros :refer [logc]]))
;;; Experiment to see if we can subscribe to database updates using core.match, in order to re-query database and get new data that will be (eventually) passed to a reagent component
;;; Initialize
(def schema {:show {}
@ducky427
ducky427 / core.cljs
Created June 11, 2015 11:31
Facebook's fixed data for reagent. Adapted from https://github.com/ul/fixed-data-table-demo
(ns datatable.core
(:require [reagent.core :as reagent]
[cljsjs.fixed-data-table]))
(def Table (reagent/adapt-react-class js/FixedDataTable.Table))
(def Column (reagent/adapt-react-class js/FixedDataTable.Column))
(defn gen-table
"Generate `size` rows vector of 4 columns vectors to mock up the table."
[size]
@gtebbutt
gtebbutt / gist:5e21f2e49592559f5043
Created December 19, 2014 14:17
Linear animation generator for Om & React
(defn animate-value
[start-val end-val duration]
(let [decrement? (< end-val start-val)
transmit-chan (chan)
cancel-chan (chan)
animation-interval 40 ;40 ms interval - 25fps
steps (/ duration animation-interval)
full-range (- start-val end-val)
per-step (util/abs (/ full-range steps))
state (atom start-val)
@sebmarkbage
sebmarkbage / ElementFactoriesAndJSX.md
Last active May 17, 2022 11:06
New React Element Factories and JSX

New React Element Factories and JSX

In React 0.12, we're making a core change to how React.createClass(...) and JSX works.

If you're using JSX in the typical way for all (and only) React components, then this transition will be seamless. Otherwise there are some minor breaking changes described below.

The Problem

@philandstuff
philandstuff / euroclojure2014.org
Last active September 18, 2025 20:18
Euroclojure 2014

EuroClojure 2014, Krakow

Fergal Byrne, Clortex: Machine Intelligence based on Jeff Hawkins’ HTM Theory

  • @fergbyrne
  • HTM = Hierarchical Temporal Memory
  • Slides

big data

  • big data is like teenage sex
    • noone knows how to do it
    • everyone thinks everyone else is doing it
@staltz
staltz / introrx.md
Last active October 26, 2025 03:06
The introduction to Reactive Programming you've been missing
@raganwald
raganwald / p.jsredicate-dispatch
Last active August 29, 2015 14:02
Faking Predicate Dispatch in JavaScript
function nameAndLength(name, length, body) {
var abcs = [ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l',
'z', 'x', 'c', 'v', 'b', 'n', 'm' ],
pars = abcs.slice(0, length),
src = "(function " + name + " (" + pars.join(',') + ") { return body.apply(this, arguments); })";
return eval(src);
}
@allgress
allgress / reagent_datascript.cljs
Last active June 4, 2025 13:03
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))