Skip to content

Instantly share code, notes, and snippets.

@manveru
manveru / rps.mint
Created May 30, 2018 20:44
Rock Paper Scissors in Mint
module ArrayPlus {
fun sample (array : Array(a)) : a {
`array[Math.floor(Math.random() * array.length)]`
}
fun at (index : Number, array : Array(a)) : a {
`array[index]`
}
}
store Counter.Store {
property counter : Number = 0
fun increment : Void {
next { state | counter = counter + 1 }
}
fun decrement : Void {
next { state | counter = counter - 1 }
}
module EditorConfig
SPEC_VERSION = "0.9.1"
# Public: Default config basename.
CONFIG_FILENAME = ".editorconfig".freeze
# Public: Universal property names.
#
# https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
INDENT_STYLE = "indent_style".freeze
@manveru
manveru / WebSocket.mint
Last active May 28, 2018 09:15
WebSocket in Mint
record Provider.WebSocket.Subscription {
endpoint : Url,
message : Function(Html.Event, Void),
open : Function(Html.Event, Void),
error : Function(Html.Event, Void)
}
provider Provider.WebSocket : Provider.WebSocket.Subscription {
fun attach : Void {
`
@manveru
manveru / README.md
Created May 17, 2018 09:21
crystal2nix

Crystal2Nix

Since I don't have time to make a proper project for this, here's how to use it:

cd $YOU_RPROJECT
crystal crystal2nix.cr

ln -s $(nix-build crystal2nix.nix)/lib

@manveru
manveru / Gemfile
Last active April 23, 2018 11:24
building EM
source 'https://rubygems.org' do
gem 'eventmachine'
end
@manveru
manveru / Gemfile
Created March 14, 2018 13:57
jekyll
source 'https://rubygems.org' do
gem 'jekyll'
end
@manveru
manveru / extractvpk.go
Created September 28, 2017 09:49
Extract VPKs
package main
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"github.com/watbe/vpk"
)
{
"dependencies": {
"greeting": "^1.0.6"
},
"name": "y2n",
"version": "1.0.0",
"main": "index.js",
"license": "MIT"
}
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.syncthing-latest;
syncthing-source = pkgs.stdenv.mkDerivation rec {
name = "syncthing-source";
version = "0.14.23";
src = pkgs.fetchurl {