Skip to content

Instantly share code, notes, and snippets.

View dz1984's full-sized avatar

Donald Zhan dz1984

View GitHub Profile
@weihanglo
weihanglo / rust-vs-go.md
Last active April 28, 2024 01:21
【譯】Rust vs. Go

【譯】Rust vs. Go

本文譯自 Julio Merino 2018 年七月撰寫的 Rust vs. Go 一文。Julio Merino 是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。

Thanks Julio Merino for this awesome article!


The thing that students have the hardest time on when learning functional programming is how to process a recursive structure while maintaining some sort of "state", the result if you will. I'll attempt here to demystify the process.

Functional programming languages almost always use a lot of recursively defined structures. Depending on the language those can be implemented in various ways, but in any case the end result is the same. A structure of this type is either an "atom", i.e. an irreducible thing, or a "compound" consisting of substructures of the same form.

For example a "list" is either an Empty/Nil list (the "atom") or it is formed as a Cons of a value and another list (compound form). That other "sublist" can itself be empty or another cons and so on and so forth. A tree is similar. It is either empty, or it consists of a triple of a value and two sub-trees, left and right.

Almost every problem we encounter is a question about doing something with all entries in a structure. To solve these prob

@ndreckshage
ndreckshage / client-javascripts-application.coffee
Created January 22, 2014 23:41
snapsecret v3 (node + ember, not all code included)
(->
Ember = require 'ember'
moment = require 'moment'
# Socket.io
io = window.io
host = location.origin.replace /^http/, 'ws'
socket = io.connect host
# SnapSecret
@sloria
sloria / bobp-python.md
Last active May 12, 2024 06:54
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@timdream
timdream / gist:5968469
Last active January 22, 2023 20:00
Github 發 Pull Request & 貢獻流程速查

Github 發 Pull Request & 貢獻流程速查

前言

此文目標讀者需先自行學會

  • 開 Github 帳號
  • 會 fork 程式 repository
  • 會在自己的電腦使用命令列 git
  • 會 clone 自己的 repository
@nzakas
nzakas / gist:5511916
Created May 3, 2013 17:47
Using GitHub inside a company

I'm doing some research on how companies use GitHub Enterprise (or public GitHub) internally. If you can help out by answering a few questions, I'd greatly appreciate it.

  1. What is the primary setup? Is there an organization and each official repo is owned by that organization?
  2. Does every engineer have a fork of each repo they're working on?
  3. Are engineers allowed to push directly to the official repo? Or must all commits go through a pull request?
  4. Do engineers work on feature branches on the main repo or on their own forks?
  5. Do you require engineers to squash commits and rebase before merging?
  6. Overall, what is the workflow for getting a new commit into the main repository?
  7. What sort of hooks do you make use of?
  8. Are there any ops issues you encountered? (Scaling, unforeseen downtime, etc.)
@bigeagle
bigeagle / gitmanul.md
Created October 25, 2012 16:49
Git Manual

Git 简要教程

##引言

鉴于使用Git有一点点门槛(比SVN稍微高一点),我写了个实用教程,如果想更进一步了解Git,或者觉得我写的太懶,推荐参考书 Progit,这本书是开源的,前四章就足够用了。

组内我和晓天、汤韬都会使用git,有问题可以线下直接问。

至于为什么要用Git,其实用SVN也是挺好的,但是SVN是集中式提交,同一时刻只能有一个人修改一个文件,这个在很多时候会比较蛋疼,另一方面SVN提交时要求联网,这样碰上断网什么的话SVN就废了。

@hugosenari
hugosenari / Ideas.md
Last active October 3, 2015 18:48
draft idea: My own ideas

This idea:

Use gist to share ideas

My Ideas:

@amueller
amueller / mlp.py
Created March 17, 2012 15:59
Multi-Layer Perceptron for scikit-learn with SGD in Python
import numpy as np
import warnings
from itertools import cycle, izip
from sklearn.utils import gen_even_slices
from sklearn.utils import shuffle
from sklearn.base import BaseEstimator
from sklearn.base import ClassifierMixin
from sklearn.preprocessing import LabelBinarizer