Skip to content

Instantly share code, notes, and snippets.

View chaozh's full-sized avatar
🎯
Focusing

chaozh chaozh

🎯
Focusing
View GitHub Profile
namespace HashTableDict
{
using System.Collections;
using System.Collections.Generic;
public class Hashtable<TKey, TValue> : IDictionary<TKey, TValue>
where TKey : class
where TValue : class
{
private readonly Hashtable _ht = new Hashtable();
@arqex
arqex / formComponent.js
Created January 18, 2016 18:37
10.nonFunctionalReact
var MyForm = React.createClass({
render: function(){
return (
<ValidationForm ref="form" onSubmit={ this.validates }>
<Input name="title" validation="required" />
<Input name="age" validation="required,number" />
<Input name="email" validation={ value => value.match(/\S+@\S+\.\S+/) } />
</ValidationForm>
);
},
@drmingdrmer
drmingdrmer / git-auto-squash
Last active May 27, 2022 05:58
Rewrite history to squash all commits wiht message starts with 'fixup!' to its first parent. By drdr.xp@gmail.com
#!/bin/bash
usage()
{
local name=${0##*/}
cat >&2 <<-END
Rewrite history to squash all commits wiht message starts with 'fixup!' to
its first parent. By drdr.xp@gmail.com
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@chaohui0
chaohui0 / libevent.cpp
Last active December 21, 2015 22:29
libevent 多线程http服务器
#include <event.h>
#include <evhttp.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <iostream>
@ourai
ourai / alibaba_campus_quiz3.md
Last active July 24, 2018 07:32
阿里巴巴集团 2014 校园招聘攻略

智勇大闯关第三季

8月20日,阿里校园招聘前端岗位的在线笔试将统一开始。在这之前,我们先玩一下热身赛吧! http://ued.taobao.com/quiz3/ 截至8月18日11:00之前成功通关并且表现优异的同学,将有机会收到我们的惊喜邮件!

以上是阿里巴巴集团校园招聘的某一条微博的内容。

虽然我早已不是学生,本着好奇心也要玩一玩此游戏!经过几个小时的奋斗,我看到了美女,但不知道那是不是 True Ending。也许很多人把游戏通关之后就不玩不去探索了,可我不一样!我玩游戏向来都是要尽量把所有隐藏要素都挖掘出来才算结束。

正是因为知道结果,才有可能去优化过程,一个工程师的职责难道不正是这个么?“如何自动化、智能地去过每一关”的想法让我的血液稍微沸腾了起来。又经过几个小时的编码及测试,自我感觉已经把“隐藏要素”挖得差不多了。现将各个关卡的过关要点及自动获取过关条件的 JavaScript 脚本放出来。

@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 30, 2024 04:42
A badass list of frontend development resources I collected over time.
@wintercn
wintercn / HTMLLexicalParser.js
Last active August 5, 2019 11:16
HTML语法分析器模型
function StartTagToken(){
}
function EndTagToken(){
}
function Attribute(){
}
@louisstow
louisstow / layers.html
Created May 20, 2013 06:06
Example of a game with 3 canvas layers.
<div id="stage">
<canvas id="ui-layer" width="480" height="320"></canvas>
<canvas id="game-layer" width="480" height="320"></canvas>
<canvas id="background-layer" width="480" height="320"></canvas>
</div>
<style>
#stage {
width: 480px;
height: 320px;
@toctan
toctan / youtube-dl.sh
Last active December 17, 2015 11:39
Download 3 videos concurrently using youtube-dl.
#!/bin/bash
i=0
while read LINE
do
(youtube-dl $LINE -o "%(title)s.%(ext)s") &
let i++
if (( $i % 3 == 0 )); then
wait # Limit to 3 concurrent subshells