Skip to content

Instantly share code, notes, and snippets.

@semperos
semperos / div.clj
Last active September 11, 2015 22:12 — forked from gfmurphy/Div.hs
Readability
(defn digits
"Generate a list of digits contained in the number"
[number]
(loop [found-digits '() base (quot number 10) digit (rem number 10)]
(let [found-digits (conj found-digits (if (neg? digit) (- digit) digit))]
(if (zero? base)
found-digits
(recur found-digits (quot base 10) (rem base 10))))))
(defn divisible-digits
@orderthruchaos
orderthruchaos / IEx.exs
Last active November 28, 2019 12:44
A possible q/0 helper for Elixir.IEx.
if ! Enum.member?(:erlang.loaded, IEx.UserDrv.Config) do
defmodule IEx.UserDrv.Config do
import Process, only: [group_leader: 0]
@moduledoc """
Structure to hold :user_drv configuration information.
"""
defstruct node: Node.self, pid: nil, port: nil, leader: group_leader
@glv
glv / bundler-exec.fish
Last active January 5, 2023 21:45
Automatically prepend "bundle exec" when appropriate (in fish shell).
# This sets up fish so that, if you type a command that should be
# run using Bundler, it first automatically prepends "bundle exec"
# to the command line buffer before executing it. Works for all
# commands found in the "bin" directory of the current bundle.
#
# To override this behavior and run such a command without Bundler,
# prefix with "command" (e.g., `command rake -T`)
#
# Pros (vs binstubs or aliases):
# * automatically adjusts to bundle changes
@bazzargh
bazzargh / ublock
Created February 27, 2018 22:04
ublock rules for twitter misfeatures
! Block friends favourited tweets
twitter.com##.tweet-has-context:not([data-retweeter])
! fake activity
twitter.com##li[data-component-context="generic_activity"]
! since you were away
twitter.com##.TimelineTweetsModule
! don't care what's trending
twitter.com##.trends.Trends.module
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active April 8, 2025 14:18
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@cgrand
cgrand / gist:564d6e8ad57299f64beb438e4a8b709f
Created July 11, 2020 20:26 — forked from KingCode/gist:773560f4ab5bf91e660a2a26e581b036
cond-let and cond-let| macros, to leverage bindings between test and result expressions, as well as earlier ones (for cond-let)
;; (cond-let
;; (odd? x) [x n] (inc x)
;; (< n 10) [y (inc n)] 10
;; :else n))
;; we want the above to yield
;; (let [x n]
;; (if (odd? x)
;; (inc x)