Skip to content

Instantly share code, notes, and snippets.

View r00k's full-sized avatar
💭
Working on Tuple (https://tuple.app)

Ben Orenstein r00k

💭
Working on Tuple (https://tuple.app)
View GitHub Profile
-- I've successfully written a random generator for Circles.
randomCircle : Random.Generator Circle
randomCircle =
Random.map4
Circle
(Random.pair (Random.float -200 200) (Random.float -200 200))
(Random.float minimumRadiusLength maximumRadiusLength)
randomColor
(Random.float 0 maximumAlpha)
@r00k
r00k / vimrc
Last active May 13, 2023 09:34
A minimal vimrc for beginners
" A minimal vimrc for new vim users to start with.
"
" Referenced here: http://www.benorenstein.com/blog/your-first-vimrc-should-be-nearly-empty/
" Original Author: Bram Moolenaar <Bram@vim.org>
" Made more minimal by: Ben Orenstein
" Last change: 2012 Jan 20
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
#!/bin/sh
# Set up Rails app. Run this script immediately after cloning the codebase.
# Exit if any subcommand fails
set -e
# Copy over configs
if ! [ -f .env ]; then
cp .sample.env .env
@r00k
r00k / retro-questions.md
Last active May 27, 2022 21:59
Helpful retrospective (retro) questions

Retro Questions

  • KPI dashboard review
  • Since our last retro, what's gone well?
  • How do we feel about our productivity and work/life balance
  • How is the product better than last week?
  • How is the company better than last week?
  • Is there anything we should ask a consultant about?
  • How is the office/ops?
  • How can we enjoy the journey more?
@r00k
r00k / gist:906356
Created April 6, 2011 19:33
Custom devise strategy
# In config/initializers/local_override.rb:
require 'devise/strategies/authenticatable'
module Devise
module Strategies
class LocalOverride < Authenticatable
def valid?
true
end
@r00k
r00k / gist:2f243be6c30325f6a9b31844d91fc910
Last active August 29, 2019 21:04
uBlock Origin filters to remove annoying Twitter features
twitter.com##.trends.Trends.module
twitter.com##.dashboard-right.dashboard
twitter.com##.module.DashboardProfileCard
@r00k
r00k / setup.sh
Last active December 29, 2018 16:41
Rails bin/setup script, from refactoringrails.io
#!/bin/sh
# Set up Rails app. Run this script immediately after cloning the codebase.
# Exit if any subcommand fails
set -e
# Copy over configs
if ! [ -f .env ]; then
cp .sample.env .env
@r00k
r00k / gist:3105024
Created July 13, 2012 13:58
Dependency Injections Pros/Cons/Questions

Dependency Injection

Pros

  • Classes are more modular, as they depend only on the interface of passed-in dependencies. Class behavior can be changed by swapping out a new component.
  • Testing is simplified, since stubs can be substituted for any dependency.

Cons

  • It's harder to understand how a class works when reading just that class. You may have to track down its invocation to see what kind of components are passed in.
isValidUrl : String -> Bool
isValidUrl str =
List.all
((|>) str)
[ isLower, hasNoSpaces ]
@r00k
r00k / gist:4658025
Created January 28, 2013 18:50
Kinda mind-blowing fibonacci-sequence-producing function.
(defn fib [n]
(take n (map first (iterate (fn [[a b]] [b (+ a b)]) [1 1]))))
(fib 5) => (1 1 2 3 5)