This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
get '/' do | |
'Hello from root' | |
end | |
get '/foo' do | |
'Hello from GET /foo' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if status is-interactive | |
# Commands to run in interactive sessions can go here | |
end | |
status --is-login; and status --is-interactive; and exec byobu-launcher | |
function rainbowify | |
# Define a set of RGB colors for the rainbow | |
set colors '255;0;0' '255;69;0' '255;140;0' '255;165;0' '255;215;0' '255;255;0' '218;255;0' '140;255;0' '69;255;0' '0;255;0' '0;255;69' '0;255;140' '0;255;215' '0;255;255' '0;215;255' '0;140;255' '0;69;255' '0;0;255' '69;0;255' '140;0;255' '215;0;255' '255;0;255' '255;0;215' '255;0;140' '255;0;69' | |
set colored_text '' | |
set char_index 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
module GSM7 | |
# https://en.wikipedia.org/wiki/GSM_03.38#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_/_GSM_03.38 | |
BASIC_CHARACTER_SET = Set.new([ | |
"\n", "\r", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "_", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "¡", "£", "¤", "¥", "§", "¿", "Ä", "Å", "Æ", "Ç", "É", "Ñ", "Ö", "Ø", "Ü", "ß", "à", "ä", "å", "æ", "è", "é", "ì", "ñ", "ò", "ö", "ø", "ù", "ü", "Γ", "Δ", "Θ", "Λ", "Ξ", "Π", "Σ", "Φ", "Ψ", "Ω" | |
]).freeze | |
def self.basic_characters_only?(string) | |
Set.new(string.chars).subset?(BASIC_CHARACTER_SET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate num_rational; // 0.1 | |
extern crate rusttype; // 0.6 | |
use num_rational::Ratio; | |
use rusttype::{Font, FontCollection, Glyph, Rect}; | |
fn main() { | |
let filename = "C:\\WINDOWS\\Fonts\\Tahoma.ttf"; | |
let font = read_font_from_filename(filename); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'execjs' | |
module Katex | |
class << self | |
JS_FILENAME = 'vendor/katex/katex.min.js' | |
JS_CTX = ::ExecJS.compile(File.read(JS_FILENAME)) | |
INLINE_REGEX = /\\\((.*?)\\\)/m.freeze | |
DISPLAY_REGEX = /\\\[(.*?)\\\]/m.freeze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import OLSystem (OLSystem, buildSystem, stepSystem, axiom) | |
import Data.Sequence (iterateN) | |
main = do | |
let algae = buildSystem "A" [ ('A', "AB"), ('B', "A") ] | |
print $ axiom <$> iterateN 7 stepSystem algae | |
-- ["A", "AB", "ABA", "ABAAB", "ABAABABA", "ABAABABAABAAB", "ABAABABAABAABABAABABA"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Flower where | |
-- there's probably mistakes in here, also it is not a serious model of the flower | |
data Pedicel = Pedicel | |
data Tepal = Tepal | |
data Sepal = Sepal | |
data Petal = Petal | |
data Perigonium = Perigonium [Tepal] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE NoMonomorphismRestriction #-} | |
-- pull in the necessary modules | |
import Control.Cond (if') | |
import Control.Monad (ap) | |
import Control.Monad.Fix (fix) | |
import Data.Foldable (null) | |
-- fold over a list | |
fold :: (a -> b -> a) -> a -> [b] -> a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: RPGPrompt | |
version: 0.1.0.0 | |
synopsis: RPG-style text prompt | |
author: Jack Willis | |
maintainer: jack@attac.us | |
license: MIT | |
build-type: Simple | |
cabal-version: >=1.10 | |
executable RPGPrompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Monoid | |
data NaiveTime = NT Int Int deriving (Show, Eq) | |
instance Monoid NaiveTime where | |
mempty = NT 0 0 | |
mappend (NT h m) (NT h' m') = NT h'' m'' | |
where h'' = (h + h' + ((m + m') `quot` 60)) `mod` 24 | |
m'' = (m + m') `mod` 60 |
NewerOlder