Skip to content

Instantly share code, notes, and snippets.

@huytd
huytd / wordle.md
Last active May 16, 2024 20:39
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@ptitfred
ptitfred / Servant.MessagePack.hs
Created February 6, 2018 00:19
Support MessagePack in your Servant APIs
-- msgpack-aeson for msgpack instance derived from aeson instances
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
module Servant.MessagePack
( MessagePack
) where
import Data.Aeson (FromJSON, ToJSON)
@bobvanderlinden
bobvanderlinden / default.nix
Created October 4, 2017 20:25
Example of reproducible deployments using nix-shell and nixops
{
server = {
deployment.targetHost = "target.host.com";
services.openssh.enable = true;
};
}
@wojteklu
wojteklu / clean_code.md
Last active July 5, 2024 12:41
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@othersmallcities
othersmallcities / flex-wrap.html
Created June 25, 2015 09:29
A workaround to wrap flexed list elements in modern flex box and float them if flex box is not available.
<!-- This gist discribes a workaround for Android <4.4 and iOS <7.
The problem is that those iOS and Android versions do not support
flexbox wrapping and make (in the case I was working on) them invisible.
The goal is to flex a list of items with a fixed width and in case of floating a fixed height.
The workaround uses Modernizr to check if modernflexbox is available.
If not or JS is turned off, everything will be floated.
@paulirish
paulirish / bling.js
Last active July 3, 2024 20:45
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@jordanpoulton
jordanpoulton / pair_programming_roles
Last active May 28, 2024 12:34
Pair Programming Role Definitions - Driver:Navigator
Driver:
-Write the code according to the navigator's specification
-Listen intently to the navigators instructions
-Ask questions wherever there is a lack of clarity
-Offer alternative solutions if you disagree with the navigator
-Where there is disagreement, defer to the navigator. If their idea fails, get to failure quickly and move on
-Make sure code is clean
-Own the computer / keyboard
-Ignore larger issues and focus on the task at hand
-Trust the navigator - ultimately the navigator has the final say in what is written
@grantslatton
grantslatton / hngen.py
Last active September 27, 2021 11:07
A program that uses Markov chains to generate probabilistic Hacker News titles.
import urllib2
import re
import sys
from collections import defaultdict
from random import random
"""
PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS
NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE
CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt"