Skip to content

Instantly share code, notes, and snippets.

@fswalker
fswalker / init.vim
Last active April 13, 2020 05:30
NeoVim config
" Basic config
set autoread " Automatically reload modified buffer
set autowriteall " Automatically write files when some commands occur
set backupcopy=yes " Fix Hot Module Reloading for parcel js
set colorcolumn=80 " Colour column 80
set cursorcolumn " Highlight the column currently under cursor
set cursorline " Highlight the line currently under cursor
set expandtab " Use spaces instead of tabs
set foldlevel=20 " Folds with a higher level will be closed
set foldmethod=indent
@fswalker
fswalker / pand.arr
Last active August 6, 2018 23:34
Panda drawing in Pyret lang
# Panda
include image
background = empty-scene(200, 200)
ear = circle(12, "solid", "black")
head = underlay-xy(ear, -15, -5,
underlay-xy(ear, -140, -5,
@fswalker
fswalker / space-invaders.rkt
Created July 7, 2018 22:28
Space invaders game written in Racket
(require 2htdp/universe)
(require 2htdp/image)
;; Space Invaders
;; Constants:
(define WIDTH 300)
(define HEIGHT 500)
@fswalker
fswalker / lambda_prompt.fish
Last active June 27, 2018 22:40
Put contents of this file in your ~/.config/fish/functions/fish_prompt.fish in order to have a cool lambda prompt
function fish_prompt --description 'Write out the prompt'
set -l color_cwd
set -l suffix
switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
@fswalker
fswalker / GitHubLicensesEx.elm
Created February 17, 2018 11:19
Example which shows how to fetch, decode and display GitHub licenses in Elm. Ellie link: https://ellie-app.com/xSTPPvrTa1/0
module Main exposing (main)
import Html as Html exposing (..)
import Http as Http
import Json.Decode as Decode exposing (Decoder)
type alias Model = Maybe (List License)
type Msg =
UpdateLicenses (Result Http.Error (List License))
@fswalker
fswalker / HttpGetEx.elm
Last active February 17, 2018 10:57
Simple example which shows usage of Elm's Http module to get some string response from GitHub api. Ellie link: https://ellie-app.com/bPZKsNPCa1/0
module Main exposing (main)
import Html as Html exposing (..)
import Http as Http
type alias Model = String
type Msg =
UpdateLicenses (Result Http.Error String)
@fswalker
fswalker / Alphabet.elm
Created September 16, 2017 16:15
Generate list of capital letters from 'A' to 'Z'
module Alphabet exposing (..)
import Char
capitalLetters : List Char
capitalLetters =
List.range (Char.toCode 'A') (Char.toCode 'Z')
|> List.map Char.fromCode
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
-module(gf).
-behaviour(gen_server).
@fswalker
fswalker / frequency.erl
Created April 24, 2017 20:55
Solution of assignment no. 2 in Week 2 of Concurrent Programming in Erlang MOOC
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
% Using the observer, set up a system of frequency server and at least two clients, and kill the frequency server when the clients are in possession of a frequency – you can make the clients “sleep” at any point using the timer:sleep/1 function – observe that the clients are killed too.
% How would you modify the clients so that they are not affected by the server terminating? How could you then shut down the entire system if you needed to?
@fswalker
fswalker / billing.erl
Last active April 11, 2017 20:52
Small program simulating simple store with mocked DB and some basic operations. Test are located at the end of the file.
-module(billing).
-export([ get_data/0
, get_barcodes/0
, get_bill/3
, print_bill/1
, test_print_bill/0
, test_print_bill2/0
, test_print_bill3/0
]).