Skip to content

Instantly share code, notes, and snippets.

import System.Directory
import System.Environment
import System.FilePath
import Control.Applicative ((<$>))
import Control.Arrow (first, second)
import Control.Monad (void)
import Data.Either (rights)
import Data.List (isSuffixOf)
import Data.Set (Set, (\\), empty, fromList, insert, singleton, toList, union)
import Text.Parsec
@staltz
staltz / introrx.md
Last active May 6, 2025 07:45
The introduction to Reactive Programming you've been missing
@stijlist
stijlist / gist:bb932fb93e22fe6260b2
Last active July 12, 2020 06:43
rich-hickey-mastery
Rich Hickey on becoming a better developer
Avatar
Rich Hickey • 3 years ago
Sorry, I have to disagree with the entire premise here.
A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.
Mastery comes from a combination of at least several of the following:
@damirarh
damirarh / SetWinStoreSetting.ps1
Created January 17, 2015 15:14
Function for changing a windows Store app setting directly in its settings.app file
function Set-WinStoreSetting {
param (
[Parameter(Mandatory=$true, Position=0)][string]$PackageName,
[Parameter(Mandatory=$true, Position=1)][string]$SettingName,
[Parameter(Mandatory=$true, Position=2)][string]$SettingValue
)
$settingsFile = [IO.Path]::Combine($env:LOCALAPPDATA, 'Packages', $PackageName, 'Settings\settings.dat')
# temporary paths
@lavalamp
lavalamp / The Three Go Landmines.markdown
Last active February 28, 2025 12:54
Golang landmines

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@orlp
orlp / chacha.h
Last active April 27, 2025 05:42
C++11 ChaCha implementation.
/*
Copyright (c) 2024 Orson Peters <[email protected]>
This software is provided 'as-is', without any express or implied warranty. In no event will the
authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
@noelwelsh
noelwelsh / Nullable.scala
Created April 17, 2015 10:38
Nullable types in Scala
object Nullable {
sealed trait NullableTag
type Nullable[A] = A with NullableTag
def nullAs[B]: Nullable[B] =
null.asInstanceOf[Nullable[B]]
implicit class ToNullable[A](val a: A) extends AnyVal {
def `?`: Nullable[A] = a.asInstanceOf[Nullable[A]]
}
@tobiasviehweger
tobiasviehweger / OutlookPSTStoreTodos.cs
Created May 5, 2015 10:11
Enable "Display reminders and tasks from this folder in the To-Do bar" for PST Store programatically
private void EnableStoreTodosAndReminders(RDOStore store)
{
//Enable store for reminders
var reminders = store.Reminders;
reminders.EnableStoreReminders();
//Collection some folders we need
var rootFolder = store.RootFolder;
var taskFolder = store.GetDefaultFolder(rdoDefaultFolders.olFolderTasks);
var inbox = store.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);
@hraban
hraban / pre-commit.md
Last active April 18, 2024 06:46
Prevent accidentally committing debug code in Git
@mattwarren
mattwarren / ClrToStringOverrides.cs
Created May 13, 2015 11:25
Using Cecil to find all the types in "System." assemblies that DON'T override ToString()
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Mono.Cecil;
namespace ClrToStringOverrides
{
internal class Program
{