Skip to content

Instantly share code, notes, and snippets.

@tjweir
tjweir / CONDTIONALS
Created April 3, 2021 18:15 — forked from alptugan/CONDTIONALS
Sonic Pi Cheat Sheet
So, let’s flip a coin: if it’s heads, play a drum, if it’s tails, play a cymbal. Easy. We can emulate a coin flip with our one_in function (introduced in the section on randomness) specifying a probability of 1 in 2: one_in(2). We can then use the result of this to decide between two pieces of code, the code to play the drum and the code to play the cymbal:
loop do
if one_in(2)
sample :drum_heavy_kick
else
sample :drum_cymbal_closed
end
@tjweir
tjweir / keybase.md
Created November 18, 2020 14:50
keybase.md

Keybase proof

I hereby claim:

  • I am tjweir on github.
  • I am tylerweir (https://keybase.io/tylerweir) on keybase.
  • I have a public key ASD2xg_3ZsRdGN8ugkjGdFEVflXq-1pdffzrjpGATnI1AQo

To claim this, I am signing this object:

@tjweir
tjweir / IosevkaConfigGen.hs
Created February 8, 2019 14:25 — forked from mrkgnao/IosevkaConfigGen.hs
Render Iosevka ligatures to Private Use Area glyphs, for Emacs
{-# LANGUAGE RecordWildCards, Arrows #-}
import Numeric
import Data.Char
import Control.Monad
import Data.Monoid ((<>))
import Data.List (nub, sort, reverse)
data RepeatBounds = RB
import Control.Applicative
import Text.ParserCombinators.ReadP
data WindInfo = WindInfo
{ dir :: Int
, speed :: Int
, gusts :: Maybe Int
}
deriving Show
@tjweir
tjweir / listing.md
Last active October 11, 2018 12:37
Haskell Learning Resources I have used and enjoyed as I have developed a Web App using Servant, Persistent and Eventful.
@tjweir
tjweir / map_calc.hs
Last active September 18, 2018 18:25
Lists of As and B, to Lists of Tuples, to merging on Keys and calcing.
import Data.Map.Strict as M
import Prelude as P
data A = A
{ aa :: Int
, ab :: Int
} deriving (Show)
data B = B
{ ba :: Int
"http://emacsredux.com/blog/2013/04/28/switch-to-previous-buffer/"
(defun switch-to-previous-buffer ()
"Switch to previously open buffer.
Repeated invocations toggle between the two most recently open buffers."
(interactive)
(switch-to-buffer (other-buffer (current-buffer) 1)))
(global-set-key (kbd "C-c b") 'switch-to-previous-buffer)
@tjweir
tjweir / make-haskell-tags.sh
Last active May 17, 2018 19:01
Make a TAGS file for my current Emacs–based Haskell dev.
#!/bin/sh
TAGS_LOCATION=$HOME/g/haskell-tags/TAGS
rm $TAGS_LOCATION
touch $TAGS_LOCATION
LIB_GHC=$HOME/g/haskell/ghc/libraries
LIB_SERVANT=$HOME/g/haskell/ghc/libraries
LIB_PERSISTENT=$HOME/g/haskell/ghc/libraries
LIB_EVENTFUL=$HOME/g/haskell/ghc/libraries
module Main where
data Command
= QuitApp
| DisplayItems
| Help
| AddItem String
| Complete Int
type Item = String
{-# language KindSignatures #-}
{-# language PolyKinds #-}
{-# language DataKinds #-}
{-# language TypeFamilies #-}
{-# language RankNTypes #-}
{-# language NoImplicitPrelude #-}
{-# language FlexibleContexts #-}
{-# language MultiParamTypeClasses #-}
{-# language GADTs #-}
{-# language ConstraintKinds #-}