Skip to content

Instantly share code, notes, and snippets.

@kflu
kflu / .ctags
Last active August 29, 2015 14:07 — forked from jesstelford/.ctags
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+)( extends .+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?(([A-Za-z][A-Za-z0-9_.]*)+):.*[-=]>.*$/\3/m,method/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/f,field/
--regex-coffee=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/f,static field/
--regex-coffee=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?/\3/f,field/
@kflu
kflu / EulerProb1.ls
Last active August 29, 2015 14:17
LiveScript implementation of Project Euler Problems
[0 to 1000]
|> filter (-> it % 3 == 0 or it % 5 == 0)
|> foldr1 (+)
@kflu
kflu / readme.md
Last active August 29, 2015 14:26

hello1

@kflu
kflu / wrapper.bat
Last active September 4, 2015 18:26 — forked from jpoehls/wrapper.bat
Batch file wrapper for a PowerShell script. Wraps execution of a PowerShell script inside a Windows batch file.
@echo off
:: Execute the PS1 file with the same name as this batch file.
set filename=%~d0%~p0%~n0.ps1
if exist "%filename%" (
PowerShell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Unrestricted -Command "& '%filename%'"
:: Collect the exit code from the PowerShell script.
set err=%errorlevel%
@kflu
kflu / Promise_reject_test.js
Created May 12, 2016 01:26
Test various error situation with promises and async/await
#!/usr/bin/env node
require('babel-polyfill');
var PromiseBB = require('bluebird');
// useless if the lost rejection Promise is not coming from BB
PromiseBB.onPossiblyUnhandledRejection(function(error) {
throw error;
});
@kflu
kflu / factorial.rkt
Created June 15, 2016 19:21
Some racket snippets
#lang racket
(define (factorial x)
(cond
[(< x 0) (raise "Value can't be less than zero")]
[(= x 0) 1]
[(= x 1) 1]
[else (* x (factorial (- x 1)))]))
(factorial 99)
(factorial -1)
@kflu
kflu / springer-free-maths-books.md
Created September 1, 2016 00:42 — forked from bishboria/springer-free-maths-books.md
Springer made a bunch of books available for free, these were the direct links
@kflu
kflu / compute_covariance.m
Created September 5, 2016 06:13
Compute covariance
clc;
close all;
mm = []
E1 = []
E2 = []
for m = 10:50:1000
e1 = 0.0;
@kflu
kflu / schedule.fsx
Last active November 13, 2016 00:53
schedule.fsx
(* Run process on a schedule
Given a process (and arguments) and a schedule, it ensures that the process is run on the schedule:
If the process is not run when it should, it's started
If the process is running when it shouldn't, it's killed
*)
module Schedule =
open System
@kflu
kflu / FakeFake.fsx
Created November 16, 2016 06:40
a drop in replacement for the core Fake functionality - dependency resolution and run tasks
(* It's a drop in replacement for the core Fake functionality - dependency resolution and run tasks
*)
open System
open System.Text
open System.Collections.Generic
open System.IO
let private args = Environment.GetCommandLineArgs() |> List.ofArray |> List.skip 2
printfn "All args: %A" args