Skip to content

Instantly share code, notes, and snippets.

@ToJans
ToJans / package.json
Last active August 29, 2015 14:19
Edit-and-continue for client-side web apps with react
{
"name": "SalesDesigner",
"version": "0.0.0",
"description": "Sales designer",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Core bvba",
"license": "",
@ToJans
ToJans / bower.json
Created April 6, 2015 18:15
A small test with webcomponents - despite my bad start (I was reading 0.5 docs and not 0.8 docs), it looks reasonably elegant
{
"name": "webcomponents",
"version": "0.0.0",
"authors": [
"Tom Janssens <[email protected]>"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
@ToJans
ToJans / index.html
Created April 6, 2015 15:16
I don't understand why something this simple doesn't work (I get back undefined is not a function)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Editor</title>
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
<link rel="import" href="elements/user-gravatar.html" />
</head>
<body>
<user-gravatar email="[email protected]"/>
@ToJans
ToJans / 99bottles.js
Last active August 29, 2015 14:14
99 bottles of beer as short as possible in ECMAScript 6 - currently 142 characters
x=""
b=r=>`${c||"No more"} bottle${c-1?"s":""} of beer${r&&c--||" on the wall"}
`
for(c=99;c;)x+=b()+b(1)+`Take one down, pass it around
`+b()
@ToJans
ToJans / maybethis.fs
Last active August 29, 2015 14:13
my ideal F# web framework; a brain dump
// these series of types define the api of the app
type Command =
| Add of CreateNewTodo
| Clear
| Delete of Guid
| Update of Guid * PatchTodo
}
and Query =
| Get of Guid
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
@ToJans
ToJans / current.fs
Last active August 29, 2015 14:13
A proposition to make f# docs a lot easier and testable, like in @elixirlang : http://elixir-lang.org/docs/stable/ex_unit/ExUnit.DocTest.html
(**
### Evaluation demo
The following is a simple calculation: *)
let test = 40 + 2
(** We can print it as follows: *)
(*** define-output:test ***)
printf "Result is: %d" test
(** The result of the previous snippet is: *)
@ToJans
ToJans / list.cs
Created January 8, 2015 10:32
A C# implementation of the Haskell List
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Pauwels.AspNet.Controllers
{
public abstract class FList<T> {
public abstract FList<T> Tail();
public abstract T Head();
@ToJans
ToJans / migrate.fsi
Created January 5, 2015 13:22
Fsharp script used to migrate from octopress to hugo
open System.IO
let oldpath = @"D:\dev\oldblog\source\_posts"
let newpath = @"D:\dev\blog\tojans.me\content\blog"
let migrate (fname:string) =
let (date,name) = fname.Substring(0,10),fname.Substring(11).ToLower()
let slug = name.Substring(0,name.Length - ".markdown".Length).ToLower()
let isNonDateLine (x:string) = x.StartsWith("date:") = false
let isNonAddThisLine (x:string) =
@ToJans
ToJans / Nat.cs
Last active August 29, 2015 14:12
Natural numbers and vectors in C# , the Idris way
// Data Nat = Z | S Nat
//
// plus : Nat -> Nat -> Nat
// plus Z y = y
// plus (S k) y = S (plus k y)
abstract class Nat {
}
class Zero : Nat {