Skip to content

Instantly share code, notes, and snippets.

View pepe's full-sized avatar

Josef Pospíšil pepe

View GitHub Profile
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@jamesmacaulay
jamesmacaulay / debounce.clj
Last active January 25, 2016 09:29
debounce with core.async
(defn debounce
([input ms] (debounce (chan) input ms))
([output input ms]
(go
(loop [val (<! input)]
(let [t (timeout ms)
[next-val port] (alts! [input t])]
(if (= port t)
(do
(>! output val)
@jodosha
jodosha / Gemfile
Last active December 9, 2020 15:09
Full stack Lotus application example
source 'https://rubygems.org'
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'
@RonJeffries
RonJeffries / payroll playground 1
Last active October 14, 2015 16:39
A Swift Playground for payroll. I have my reasons ...
// Swift playground experimenting with payroll.
// (I have my reasons.)
println("Hello")
import Foundation
// This stuff sets rounding to two places after decimal
var mode = NSRoundingMode.RoundPlain
@john2x
john2x / 00_destructuring.md
Last active April 23, 2024 13:18
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

@rarous
rarous / orig.clj
Last active November 27, 2017 09:38
Refactoring of Tic-Tac-Toe in Clojure
(ns piskvorky.core
(:require [clojure.string :as s])
(:gen-class))
(defn usage []
(println "Ahoj v piskvorkach naslepo.\nPovolene prikazy jsou:\nnew - nova hra\nquit - konec\n[a-i][0-9] - tah na pole, kde rada je pozice a, b, c, d, e, f, g, h, i. Sloupec je 1 ... az 9.\nformat zapisu je napr. e5\nZacina x"))
(defn make-board []
(vec (repeat 9 (vec (repeat 9 :nothing)))))
@mattdenner
mattdenner / gist:dd4cfde3f355ff6b7be8
Last active May 18, 2016 18:52
From imperative to functional: functors, applicatives, monads & other link bait

I’ve been writing a load of Swift code recently for work and this has lead me into the world of typed functional programming. The app needs to build certain objects from a comma separated string, and this lead me to applicative functors, which lead me to brain ache but enlightenment. So here’s my thoughts on how I got to understand these a little better.

All of the code is in Swift, so less clean than Haskell. I’m also only a about 6 weeks into Swift development so I probably haven’t got all of the idioms right. I’ve avoided the optional shorthand wherever possible here, preferring Optional<Type> over Type? because I believe the latter is hiding something that helps understand this code in the context of other generic classes.

It’s also long! I think it’s probably the longest blog post I’ve ever written but I found it interesting and useful, for myself, to write. If you’re one of those people who skip to the end of a book to find out whodunit then I’ve included

@jacklynrose
jacklynrose / motion-kit-love.rb
Created December 18, 2014 10:31
I do love motion-kit
class ProfileLayout < MotionKit::Layout
def layout
add UIImageView, :profile_image
add UILabel, :name_label
add UILabel, :bio_label
background_color UIColor.whiteColor
end
def profile_image_style
@NoamB
NoamB / gist:6e940775dfa63c73ee9c
Last active May 15, 2019 18:03
camelize-dasherize mini library
(ns util.camelize-dasherize
(:import (clojure.lang IPersistentMap Keyword))
(:require [clojure.string :as s]
[clojure.zip :as zip]))
; TODO: regex is slow, should try iterating the string.
(defn dasherize-string
"Converts an underscored or camelized string
into an dasherized one."
[s]