Skip to content

Instantly share code, notes, and snippets.

View zhenyanghua's full-sized avatar
🐢
I may be slow to respond.

Zhenyang Hua zhenyanghua

🐢
I may be slow to respond.
View GitHub Profile
@zhenyanghua
zhenyanghua / coinsSums.js
Last active January 27, 2017 02:32
Games
/**
* Given an array of coins type, and an array of quatity for each type,
* find out the possible sums.
*/
function Set() {
this.set = {};
}
Set.prototype.add = function(value) {
if (!this.set[value]) this.set[value] = true;
}
@zhenyanghua
zhenyanghua / index.html
Last active February 16, 2017 19:48
ES6 Naive Data Binding
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test</title>
<link rel="stylesheet" href="">
<style>
body { background-color: rice; }
ul {
@zhenyanghua
zhenyanghua / GeoMock.ts
Created March 3, 2017 19:04
GeoMock plus
export class GeoMock {
constructor() {
if (typeof navigator === "undefined" || navigator === null) {
window.navigator = {};
}
if (navigator.geolocation == null) {
window.navigator.geolocation = {};
}
navigator.geolocation.delay = 1000;
navigator.geolocation.shouldFail = true;
@zhenyanghua
zhenyanghua / README.md
Last active June 14, 2017 15:41
Git Cheat Sheet

pull the latest of the current branch

git pull

add all local changes to the stage and commit the staged local changes.

git commit –am “comments”

stash the local changes

@zhenyanghua
zhenyanghua / Dockerfile.jdk
Last active January 9, 2018 14:15
Dockerfiles
RUN apt-get -y install debconf-utils
RUN add-apt-repository -y ppa:webupd8team/java
RUN apt-get update
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN apt-get -y install oracle-java8-installer
@zhenyanghua
zhenyanghua / FtpUtility.cs
Last active January 22, 2018 14:44
Facade Pattern Example
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using NLog;
using WebGrease.Css.Ast.Selectors;
@zhenyanghua
zhenyanghua / SearchArt.java
Last active September 7, 2018 17:56
OOA&D wk1
import java.util.List;
import java.util.LinkedList;
class ArtWork {
private String serialNumber;
private double price;
private String material;
private String type;
private String series;
@zhenyanghua
zhenyanghua / Docker.md
Last active November 6, 2018 03:31
K8s Notes

Inspect container and filter by its property

docker inspect -f '{{ .NetworkSettings.IPAddress }}' container_name

Run a nginx container in a detached interactive terminal that maps the host port 8088 to the nginx webserver port and open a shell in the interactive terminal.

docker run -dit --name my-nginx -p 8088:80 nginx /bin/bash 
@zhenyanghua
zhenyanghua / .block
Created January 16, 2021 17:13 — forked from d3indepth/.block
D3 geo lines, circles and graticule
license: gpl-3.0
height: 420
border: no
@zhenyanghua
zhenyanghua / .block
Created January 17, 2021 00:57 — forked from d3indepth/.block
Spinning globe
license: gpl-3.0
height: 440
border: no