Skip to content

Instantly share code, notes, and snippets.

@wk-j
wk-j / dotnetlayout.md
Created July 12, 2022 09:16 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@wk-j
wk-j / TLMBot.js
Created April 12, 2021 13:35 — forked from earthchie/TLMBot.js
class TLMBot {
constructor(minWaitTime = 5000, maxWaitTime = 15000) {
this.minWaitTime = minWaitTime;
this.maxWaitTime = maxWaitTime;
this.isMining = false;
this.isBotRunning = false;
this.startedAt = 0;
this.initialBalance = 0;
this.accumulate = 0;
@wk-j
wk-j / nginx.conf
Created September 15, 2017 10:02 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:
@wk-j
wk-j / Ternary.hs
Created June 15, 2017 07:59 — forked from Burgestrand/Ternary.hs
Ternary operator for haskell
module Ternary where
-- | Ternary operator.
-- Usage: (i > 0) ? i $ 1
(?) :: Bool -> a -> a -> a
True ? x = const x
False ? _ = id
-- | Higher order ternary operator.
-- Usage: (not . null) ?? "" $ "default"
@wk-j
wk-j / TypeSystems.md
Last active May 25, 2017 14:06 — forked from halgari/gist:f431b2d1094e4ec1e933969969489854
What I want from a Type System

The question was asked why I (as a programmer who prefers dynamic languages) don't consider static types "worth it". Here is a short list of what I would need from a type system for it to be truely useful to me:

  1. Full type inference. I would really prefer to be able to write:
(defn concat-names [person]
  (assoc person :full-name (str (:first-name person)
                                (:second-name person))))
@wk-j
wk-j / fp-lingo.md
Created March 16, 2017 13:00 — forked from ericelliott/fp-lingo.md
A Guide to Functional Programming Lingo for JavaScripters

A Guide to Functional Programming Lingo for JavaScripters

Functional programming gets a bad wrap about being too hard for mere mortals to comprehend. This is nonsense. The concepts are actually quite simple to grasp.

The jargon is the hardest part. A lot of that vocabulary comes from a specialized field of mathematical study called category theory (with a liberal sprinkling of type theory and abstract algebra). This sounds a lot scarier than it is. You can do this!

All examples using ES6 syntax. wrap (foo) => bar means:

function wrap (foo) {
@wk-j
wk-j / Tuple2.fs
Created September 14, 2016 04:36 — forked from ploeh/Tuple2.fs
Helpful functions for working with pairs in F#
module Tuple2
let replicate x = x, x
let curry f x y = f (x, y)
let uncurry f (x, y) = f x y
let swap (x, y) = (y, x)
@wk-j
wk-j / gist:e2d8e641b000b54bc2c23e67bc9fd4a8
Created September 12, 2016 07:29 — forked from tarnacious/gist:874052
Compiling SelectMany Linq without System.Linq. Also a List Monad.
using System;
using System.Collections.Generic;
public static class ExtensionMethods
{
public static IEnumerable<T> ToList<T>(this T value) {
yield return value;
}
public static IEnumerable<U> SelectMany<T, U>(this IEnumerable<T> m, Func<T, IEnumerable<U>> k)
@wk-j
wk-j / CSharp6.md
Created August 1, 2016 06:04 — forked from ashmind/CSharp6.md

String interpolation

var x = 1;

// same as string.Format("A {0} B", x) 
var y1 = $"A {x} B"; // y == "A 1 B"

// $@ for multiline
var y2 = $@"A
@wk-j
wk-j / active.md
Created July 30, 2016 05:41 — forked from statguy/active.md

Most active GitHub users in Thailand

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 29 Jul 2015 01:52:41 GMT till Fri, 29 Jul 2016 01:52:41 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 6)