Skip to content

Instantly share code, notes, and snippets.

Yufan Lou louy2

Block or report user

Report or block louy2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chalmagean
chalmagean / onSelect.elm
Last active Dec 22, 2016
Elm onSelect decoder
View onSelect.elm
-- Assuming we have a list of items in the model (type alias Model = { items : List Item }
-- where Item is a record like { id : Int, name : String }
-- this goes in the view and generates an html dropdown
select
[ onSelect ValueSelectedMsg ]
(List.map (\item -> option [ value (toString item.id) ] [ text item.name ]) model.items)
targetSelectedIndex : Json.Decoder Int
View lib.rs
#![feature(test)]
extern crate rand;
extern crate test;
#[macro_use]
extern crate nom;
use nom::*;
View bitcoin-paper-errata-and-details.md

A description of known problems in Satoshi Nakamoto's paper, "Bitcoin: A Peer-to-Peer Electronic Cash System", as well as notes on terminology changes and how Bitcoin's implementation differs from that described in the paper.

Abstract

The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power.

View Readme.md

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@rauchg
rauchg / README.md
Last active Jun 7, 2019
require-from-twitter
View README.md
@mikehearn
mikehearn / threadbox.kt
Created Aug 15, 2015
More advanced ThreadBox with affinity guards
View threadbox.kt
// This is a class that attempts to stop you accessing variables outside a lock.
//
// It does not do a perfect job, but can catch some common kinds of mistake, in
// particular when you accidentally try to work with objects inside closures that
// end up running later, outside the locked region (or in a different thread).
// EXAMPLE
val bank = ThreadBox(object {
val accounts by arrayListOf(10, 0, 0, 0).guard()
@martinmoene
martinmoene / catch-main.cpp
Last active Sep 6, 2017
CATCH - Small complete multi-file example.
View catch-main.cpp
// This tells Catch to provide a main() - only do this in one cpp file:
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
@benjie
benjie / README.md
Last active Nov 27, 2018
Long Live CoffeeScript and Long Live ES6
View README.md

Long Live CoffeeScript and Long Live ES6

Clearly ES6 is a huge improvement over ES5, and tools like [6to5][] allow us to use these cool features now. I was reading [Replace CoffeeScript with ES6][replace coffeescript] by [Blake Williams][] and thought it was a great summary of how ES6 solves many of the same problems that CoffeeScript solves; however I'd like to comment on a few of Blake's points and talk about why I'll be sticking with CoffeeScript.

Classes

Classes in ES6 (like many of the syntax changes in ES6) are very similar to the CoffeeScript equivalent. To support browsers that are not fully ES5 compliant (e.g. IE8-), however, we still can't really use getters/setters, so ignoring these the comparison is:

@andybarilla
andybarilla / hover.py
Last active May 23, 2019
DDNS Script for Hover (using their unofficial API)
View hover.py
#!/usr/bin/env python
"""hover.py: Provides dynamic DNS functionality for Hover.com using their unofficial API.
This script is based off one by Dan Krause: https://gist.github.com/dankrause/5585907"""
__author__ = "Andrew Barilla"
__credits__ = ["Andrew Barilla", "Dan Krause"]
__license__ = "GPL"
__version__ = "1.0"
__maintainer__ = "Andrew Barilla"
@grugq
grugq / gist:03167bed45e774551155
Last active Jun 22, 2019
operational pgp - draft
View gist:03167bed45e774551155

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

You can’t perform that action at this time.