Skip to content

Instantly share code, notes, and snippets.

Working from home

Raymond Cheng akulubala

Working from home
Block or report user

Report or block akulubala

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
View gist:f8b3ed830442589be134ec88aa04a5ff
brew install socat
brew cask install xquartz
open -a XQuartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
# in another window
docker run -e DISPLAY=(current computer ip address):0 jess/gear
View Install protobuf 3 on Ubuntu
# Make sure you grab the latest version
curl -OL
# Unzip
unzip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
akulubala /
Created Feb 22, 2018 — forked from davejamesmiller/
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

Accessing the Container

View javascript 随机数组
let puzzleArr = [];
i = 1;
// 生成包含1 ~ 15数字的数组
for (i; i < 16; i++) {
// 随机打乱数组
puzzleArr = puzzleArr.sort(() => {
akulubala / gist:d5c6bd61b941a26dd9a107862c17047e
Created Jul 8, 2016
View gist:d5c6bd61b941a26dd9a107862c17047e
var digitUppercase = function(n) {
var fraction = ['角', '分'];
var digit = [
'零', '壹', '贰', '叁', '肆',
'伍', '陆', '柒', '捌', '玖'
var unit = [
['元', '万', '亿'],
['', '拾', '佰', '仟']
View gist:24e3bac34f34098a9aec4cb92eac2fe1
$strArrays = array_merge(range('a', 'z'), range('AA', 'ZZ'));
echo $strArrays[3]
akulubala / gist:4d4e5868eeaef33a5c62
Created Jan 24, 2016
underscore template usage
View gist:4d4e5868eeaef33a5c62
var tpl = _.template($("#template_errors").html(),{variable: 'items'});// define variable to retrive
var html = tpl(response.responseJSON); //pass datas to be loop
// template to use
<script type="text/template" id="template_errors">
<div class="error-list">
<% _.each(items,function(item,key,arr) { %>
View larave 5.1 创建scheduler
env EDITOR=nano crontab -e
* * * * * /usr/local/bin/php /path/to/artisan schedule:run 1>> /dev/null 2>&1(需要指定PHP路径)
Ctrl+o 保存cron
Ctrl+x 退出nano
创建 crontab /var/www/cron/xxx.cron ->开始cron保存的位置
View gist:e9e6b3ed680937259198
def divid2(array,v):
low = 0
high = len(array)-1
while low<=high:
mid = (low+high)>>1
if v < array[mid]:
high = mid
elif v > array[mid]:
low = mid
You can’t perform that action at this time.