Skip to content

Instantly share code, notes, and snippets.

View chadluo's full-sized avatar
🟢
pls gib green

Chad Luo chadluo

🟢
pls gib green
View GitHub Profile
@chadluo
chadluo / Ties.java
Last active June 3, 2020 05:00
enumerate electoral college ties
import java.util.Set;
import java.util.stream.*;
public class Ties {
// https://en.wikipedia.org/wiki/United_States_Electoral_College#Current_electoral_vote_distribution
private static final String[] STATES = {
"AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA",
"KS", "KY", "LA", "ME", "ME-1", "ME-2", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NE-1",
@-moz-document domain("en.wikipedia.org"), domain("en.wikiquote.org") {
body,
.mw-body-content h2 {
font-family: 'IBM Plex Sans', sans-serif
}
.mw-body h1,
.mw-body-content h1 {
font-family: 'IBM Plex Mono', monospace
}
@chadluo
chadluo / extensions.md
Last active September 13, 2019 13:06
vscode config

Insiders

  • bierner.emojisense
  • DotJoshJohnson.xml
  • emilast.LogFileHighlighter
  • esbenp.prettier-vscode
  • file-icons.file-icons
  • goessner.mdmath
  • johnpapa.vscode-peacock
  • k--kato.intellij-idea-keybindings
@chadluo
chadluo / using_git-svn.md
Last active June 14, 2018 03:26 — forked from rickyah/using_git-svn.md
A simple guide to git-svn

Getting started with git-svn

git-svn is a git command that allows using git to interact with Subversion repositories. git-svn is part of git, meaning that is NOT a plugin but actually bundled with your git installation. SourceTree also happens to support this command so you can use it with your usual workflow.

Reference: http://git-scm.com/book/en/v1/Git-and-Other-Systems-Git-and-Subversion

Cloning the SVN repository

You need to create a new local copy of the repository with the command

# installer; see https://www.thomasmaurer.ch/2019/03/how-to-install-and-update-powershell-6/
# iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
# edit this script
# $EDITOR $profile
# Administrator, enable this script
# Set-ExecutionPolicy RemoteSigned
# incremental tab completion
@chadluo
chadluo / stylish.json
Last active March 29, 2018 04:41
=> .json,.bin
[
{
"method": "saveStyle",
"name": "GitHub",
"enabled": true,
"sections": [
{
"urls": [],
"urlPrefixes": [],
"domains": [
@chadluo
chadluo / skeleton-grid.md
Last active April 2, 2016 17:29
where offsets were not documented

Homepage

.container
  .row
    .one.column ~ .eleven.columns
    .one-third.column ~ .two-thirds.column
    .one-half.column

 .offset-by-one.column ~ .offset-by-eleven.columns
@chadluo
chadluo / readme.md
Created March 20, 2016 13:15
Hakyll short guide

How it works

Build a binary and generate static files from this binary.

Install

  1. stack new mysite hakyll-template
  2. cd mysite
  3. init as git repo
  4. stack build which could take long enough time for a laundry
@chadluo
chadluo / pretty_print.c
Created September 29, 2015 16:15
a trivial array pretty print.
#include <stdio.h>
int main() {
int arr[] = {1, 2, 3, 4, 5};
int size = 5;
for (int i = 0; i < size; i++)
printf((i == 0 ? "[%d" : i == size - 1 ? ", %d]\n" : ", %d"), arr[i]);
// "[1, 2, 3, 4, 5]"
return 0;
}
@chadluo
chadluo / lab2.hs
Last active August 29, 2015 14:24
FP101x Section 5 lab 2
module Lab2 where
import Data.Char
import Test.QuickCheck
-------------------------------------------------------------------------------
-- Lab 2: Validating Credit Card Numbers
-------------------------------------------------------------------------------
(|>) :: a -> (a -> b) -> b