Skip to content

Instantly share code, notes, and snippets.

Lim Yang Wei yang-wei

Block or report user

Report or block yang-wei

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
@yang-wei
yang-wei / README.md
Last active Aug 8, 2018
PHP extension ext-memcached * is missing from your system
View README.md
➜  admin git:(master) phpbrew --version
phpbrew - 1.23.1
cliframework core: 2.5.4
➜  admin git:(master) php -v
PHP 5.6.30 (cli) (built: Aug  7 2018 17:48:36)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
➜  admin git:(master) which php
/Users/l-wei/.phpbrew/php/php-5.6.30/bin/php
View README.md
go run server.go

curl

curl -v -H 'Content-Type: multipart/form-data' -F "uploadfile=@./sample_video.mp4" -k http://localhost:8080/upload
@yang-wei
yang-wei / README.md
Last active Jan 2, 2018
thoughts on Vietnam
View README.md
  • Vietnam people honks and beeps a lot on the road. FYI https://saigoneer.com/saigon-culture/2172-a-guide-to-honking-in-vietnam
  • Sounds like they are angry while most of the time they just talk normally
  • Riding a motorbike is relatively safe. Speed are slow and they are good at communicating(honks and beeps) on the road
  • use tissues (mostly provided) to clean spoon and fork before having food on food stall
  • "pho" heaven
  • A lot of vegetables are served for a bowl of "pho"
  • Vietnamese (the language) is so so so difficult, especially the pronunciation part. Mandarin has 4 tones while Vietnamese has 6 tones !!! (Will never laugh at their accent when speaking other languages)
  • It's called Saigon(former name) instead Ho Chi Minh City by local
  • Vietnamese love picnic with friends, family. You can see a lot of picnic group on riverside of Saigon everyday
  • Motorbike can be romantic
@yang-wei
yang-wei / chunkify.php
Created Mar 18, 2017
Chukify - PHP utils to break function with large array parameter into multiple calls and combine the result
View chunkify.php
<?php
class Helper {
/**
* Break up process for function with first large array parameter into multiple time and merge
* Can be useful when thing are slow querying database or requesting api with large size of array at once
*/
public static function chunkify(callable $fn, array $fnFirstParam = [], $chunkSize=1000, ...$fnRestParams) {
$result = [];
foreach (array_chunk($fnFirstParam, $chunkSize) as $chunk) {
@yang-wei
yang-wei / DatePeriodHelper.php
Created Dec 3, 2016
DateTime range overlapped ?
View DatePeriodHelper.php
<?php
use DatePeriod;
class DatePeriodHelper
{
/**
* @param DatePeriod $datePeriod1
* @param DatePeriod $datePeriod2
View appdelete.m
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
@yang-wei
yang-wei / country.py
Last active Aug 18, 2016
List of country codes (ISO 3166-1 alpha-2)
View country.py
("AF","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BQ","BA","BW","BV","BR","IO","BN","BG","BF","BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM","CG","CD","CK","CR","CI","HR","CU","CW","CY","CZ","DK","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","ST","SA","SN","RS","SC","SL","SG","SX","SK","SI","SB","SO","ZA
@yang-wei
yang-wei / index.js
Created Aug 14, 2016
Gisty is coming
View index.js
Gisty testing
@yang-wei
yang-wei / README.md
Last active Aug 14, 2016
What's so great about transducer ?
View README.md

This is not a introduction post to Clojure transducer. Instead there are a lots of great introduction post out there. This post aims to clarify the greatness of transduer. In the introduction blog, this is how they describe:

Transducers are composable algorithmic transformations. They are independent from the context of their input and output sources and specify only the essence of the transformation in terms of an individual element. Because transducers are decoupled from input or output sources, they can be used in many different processes - collections, streams, channels, observables, etc. Transducers compose directly, without awareness of input or creation of intermediate aggregates.

This post will help you understand the above statement.

For me transducer does 2 great things

  • Parallel process
  • Independence input source, therefore reuseable
@yang-wei
yang-wei / decorators.js
Created Aug 7, 2016
Function decorators
View decorators.js
const not = fn => x => !fn(x)
const some = x => x != null
const notAtAll = x => !some(x)
// or
const notAtAll = x => not(some)
You can’t perform that action at this time.