This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello and welcome! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugins": [ | |
"react", | |
"you-dont-need-lodash-underscore" | |
], | |
"extends": [ | |
"eslint:recommended", | |
"plugin:react/recommended" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -i 's/downloads.openwrt.org/openwrt.proxy.ustclug.org/' /etc/opkg/distfeeds.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path=/opt/docker/etc/nginx/vhost.conf | |
endpoint="fastcgi_read_timeout" | |
patch="fastcgi_buffer_size 128k;fastcgi_buffers 32 32k;" | |
if grep -q "$patch" $path ; then | |
echo 'already patched, skip!' | |
else | |
echo 'no patch found, now patch' | |
sed -i "/$endpoint/i $patch" $path | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq) | |
for author in ${authors}; do | |
echo "${author} = NAME <USER@DOMAIN>"; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tree = []; | |
var transData = function (a, idStr, pidStr, childrenStr){ | |
var r = [], hash = {}, id = idStr, pid = pidStr, children = childrenStr, i = 0, j = 0, len = a.length; | |
for(; i < len; i++){ | |
hash[a[i][id]] = a[i]; | |
} | |
for(; j < len; j++){ | |
var aVal = a[j], hashVP = hash[aVal[pid]]; | |
if (hashVP) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PostsController extends Controller | |
{ | |
protected $api; | |
protected $auth; | |
public function __construct(Dingo\Api\Dispatcher $api, Dingo\Api\Auth\Shield $auth) | |
{ | |
$this->api = $api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('posts/{ids}', function ($ids) { | |
$ids = explode(',', $ids); | |
return Post::whereIn('id', $ids)->get(); | |
})->where('ids', '[\d,]+'); | |
Route::get('posts', function () { | |
return Response::api()->withCollection(Post::all(), new PostTransformer); | |
}); |