Skip to content

Instantly share code, notes, and snippets.

@ghoseb
ghoseb / clj_spec_playground.clj
Last active March 30, 2019 22:35
Examples of Clojure's new clojure.spec library
(ns clj-spec-playground
(:require [clojure.string :as str]
[clojure.spec :as s]
[clojure.test.check.generators :as gen]))
;;; examples of clojure.spec being used like a gradual/dependently typed system.
(defn make-user
"Create a map of inputs after splitting name."
([name email]
@Deraen
Deraen / 00_notes.md
Last active October 1, 2019 08:40
Compojure-api and Buddy
  • (:identity req) is auth backend independent way to access user data
  • login and logout implementation depends on auth backend
  • :current-user doesn't imply that authentication is required, route should also have :auth-rules if authentication is required
@pandasauce
pandasauce / radiff2.log
Last active September 22, 2020 14:22
Chrome 75.0.3770.142 font rendering fix
# 75.0.3770.142
0x04b58615 7626 => 9090 0x04b58615
0x04b5861d 31c0488945 => 9090909090 0x04b5861d
Due to a beautiful bug in Chromium, it turns out you don't need this binary patch and can **enable** subpixel positioning by asking Chrome **to disable it**: https://bugs.chromium.org/p/chromium/issues/detail?id=824153#c39
Needless to say, I won't be maintaining this gist any longer.
@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@wknapik
wknapik / .zshrc
Last active December 28, 2022 13:55
[tmux/zsh] Print matching lines of output (stdout and stderr) from the last command run in an interactive shell, without rerunning the command
# This function greps everything between the last two prompts in the current tmux pane.
# Arguments are passed to `grep -i', so any valid `grep' options can be supplied.
# Requirements: coreutils, grep, sed, tmux, zsh.
just() {
local -r max=10000 psone="$(print -P "$PS1"|sed "s,\x1B\[[0-9;]*[a-zA-Z],,g")"
local inside=0;
tmux capture-pane -pS-"$max" -E"$max"|tac|\
while IFS= read -r line; do
case "$inside,$line" in
@prakhar1989
prakhar1989 / richhickey.md
Last active November 8, 2023 17:19 — forked from stijlist/gist:bb932fb93e22fe6260b2
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@ah45
ah45 / railway_oriented_programming.clj
Last active January 16, 2024 13:31
Railway Oriented Programming in Clojure using (funcool) Cats
(ns railway-oriented-programming
"An adaptation of [Railway Oriented Programming](rop) using the
[Cats](cats) library in Clojure.
[rop]: http://fsharpforfunandprofit.com/posts/recipe-part2/
[cats]: https://github.com/funcool/cats"
(:require [cats.builtin]
[cats.core :as cats]
[cats.monad.either :as either]))
@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&amp;rep=rep1&amp;t
@naaman
naaman / gist:1053217
Created June 29, 2011 05:33
Hot Swapping With Maven, Jetty and IntelliJ

Hot Swapping With Maven, Jetty and IntelliJ

Based on Configuring Jetty, Maven, and Eclipse together with Hot Swap

I've always been a bit jealous when it comes to the Play! framework and the great dev mode they have for hot swapping classes at runtime. Jetty has a configuration setting, scanIntervalSeconds, that mimics this when working with a more traditional WAR, but does so by looking for changes to a file and restarting the server.

Fortunately, Jetty also provides the ability to rapidly test code with hot swapping. No more server restarts. The trick to getting hot swapping to work is to attach a remote debugger to your Jetty process. The following instructions outline how to do this in IntelliJ (tested with IDEA 10.5 CE).

Modify your jetty-maven-plugin to ignore the scan interval

  1. Open your pom and locate the plugins section
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question: