Skip to content

Instantly share code, notes, and snippets.

@mike-thompson-day8
mike-thompson-day8 / debug.md
Last active May 23, 2016 16:58
An alternative to the offical re-frame debug middleware
(defn debug-cljs-devtools
  "This is a drop-in alternative for the offical re-frame `debug` middleware
  It is better because: 
    - it writes data, rather than strings, to js/console. This better leverages  
      the power of cljs-devtols.
    - it exploits js/console's ability to colorize text, hopefully making the 
      output easier to grok."
  [handler]
 (fn debug-handler
@nberger
nberger / reagent_infinite_scroll.cljs
Last active May 6, 2024 16:15
Reagent infinite scroll
(ns views.infinite-scroll
(:require
[reagent.core :as r]))
(defn- get-scroll-top []
(if (exists? (.-pageYOffset js/window))
(.-pageYOffset js/window)
(.-scrollTop (or (.-documentElement js/document)
(.-parentNode (.-body js/document))
(.-body js/document)))))
;; Auto-scrolling ==============================================================
(defn scroll! [el start end time]
(.play (goog.fx.dom.Scroll. el (clj->js start) (clj->js end) time)))
(defn scrolled-to-end? [el tolerance]
;; at-end?: element.scrollHeight - element.scrollTop === element.clientHeight
(> tolerance (- (.-scrollHeight el) (.-scrollTop el) (.-clientHeight el))))
(defn autoscroll-list [{:keys [children class scroll?] :as opts}]
@xfsnowind
xfsnowind / debounce.clj
Created October 23, 2015 22:08
The clojure version with library core.async of debounce function
(defn debounce-chan
"Taken from https://github.com/swannodette/async-tests
A little different with original one, write to channel after the interval
instead of doing it in the beginning"
([source msecs]
(debounce-chan (chan) source msecs))
([c source msecs]
(go-loop [state ::init
last-one nil
cs [source]]
@john2x
john2x / 00_destructuring.md
Last active June 6, 2024 13:40
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@kwent
kwent / backup_neo4j_to_s3.sh
Last active November 27, 2019 05:38
NEO4J Backup to AWS S3 Shell Script
#!/bin/sh -
#title :backup_neo4j_to_s3.sh
#description :This script is creating a NEO4J Backup through neo4j-backup tool,
# compress the backup folder via LZMA2 algorithm compression, and upload it to AWS S3.
#author :Quentin Rousseau <contact@quent.in>
#date :2014-07-28
#version :1.1
#usage :sh backup_neo4j_to_s3.sh ip port destination | eg. sh backup_neo4j_to_s3.sh 127.0.0.1 6362 /mnt/datadisk/backup
#dependencies :apt-get update && apt-get install p7zip-full && apt-get install awscli.
#==============================================================================
@staltz
staltz / introrx.md
Last active July 8, 2024 15:46
The introduction to Reactive Programming you've been missing
@wrobstory
wrobstory / .gitignore
Last active May 13, 2019 12:19
PyData2014
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active July 6, 2024 20:09
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@CarloMicieli
CarloMicieli / install-ubuntu.sh
Last active May 6, 2017 08:11
Installation script for Ubuntu 16.04
#!/bin/bash
## Constants
NONE='\e[39m'
RED='\e[31m'
GREEN='\e[32m'
CYAN='\e[36m'
### ======================================================================= ###
### HELPER FUNCTIONS ###