Skip to content

Instantly share code, notes, and snippets.

View rjregenold's full-sized avatar

RJ Regenold rjregenold

  • Provider Science
  • Texas
View GitHub Profile
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session

A Quick and Dirty Lens primer

Why does Lens exist? Well, Haskell records suck, for a number of reasons. I will enumerate them using this sample record.

data User = User { login    :: Text
                 , password :: ByteString
                 , email    :: Text
                 , created  :: UTCTime
 }
@chrisdone
chrisdone / DBAPI.hs
Last active April 10, 2022 07:26
Defaulting fields in a record in Haskell
{-# LANGUAGE DataKinds #-}
-- | My database API.
module DBAPI where
import Data.Defaults
data ConnSpec p = ConnSpec
{ username :: !(Required p String)
@yevgenko
yevgenko / .Xdefaults
Created August 24, 2011 02:58
URxvt settings with solarized theme
!-------------------------------------------------------------------------------
! Xft settings
!-------------------------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: false
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
@nebiros
nebiros / Gemfile
Created May 23, 2012 15:58
rails + unicorn + rbenv + init.d daemon
group :production do
gem "unicorn"
end
@DamienCassou
DamienCassou / configuration.nix
Created October 22, 2014 13:41
configuration.nix file for NixOS on my macbook pro
{ config, pkgs, ... }:
let
hostname = "luz3";
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# I use VirtualBox to connect to Windows and Linux guests
@eNeRGy164
eNeRGy164 / LoremIpsumKeyVault.json
Last active March 19, 2021 06:34
Deployment Template sample adding Secrets to a Azure Key Vault
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.KeyVault/vaults",
"name": "LoremVault",
"apiVersion": "2015-06-01",
"location": "[resourceGroup().location]",
"properties": {
@guillaumebort
guillaumebort / 1.sql
Created May 25, 2012 15:17
Play 2.0/Anorm
# --- !Ups
CREATE TABLE users(
email VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255)
);
CREATE TABLE subjects(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
title LONGTEXT NOT NULL,
@mpilquist
mpilquist / RWS.scala
Created April 12, 2012 01:41
Initial attempt at using Tony Morris's ReaderWriterStateT monad transformer (see https://gist.github.com/2360532)
object RWS extends App {
trait Pointed[P[_]] {
def point[A](a: A): P[A]
}
trait PointedFunctor[PF[_]] extends Pointed[PF] with Functor[PF]
implicit def listIsMonoid[A]: Monoid[List[A]] = new Monoid[List[A]] {
def id: List[A] = Nil
@fwenzel
fwenzel / lion-virtualenv.sh
Created July 21, 2011 17:42
Recreating virtualenvs after upgrading to OS X Lion.
# Upgrade to OS X Lion, notice your virtualenvs are all hosed.
# Install Xcode 4.1 from the app store (or //fs2/IT/Apple/).
# Make sure to actually *run* the install, it's an app inside Applications. Throw it away afterwards, if you want the space back.
sudo easy_install pip
sudo pip install virtualenv virtualenvwrapper ipython
# blow the old one(s) away
rmvirtualenv playdoh