View press.one
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
https://press.one/p/address/v?s=0d80826215b9101cfb46e551202cb9db44c6ae6c608020ad301cd46d3f8eb0dde15718edd6f46e768dec4617dad23bc203f0d791a3369e08fa6b4fc0ef2244371&h=973c23a77c5d9bf694f718f3afd579fa5e97a411cd71e4d6dadf8299133a7b6f&a=ee8917ea16dc93624aa7d604e7a328db246c787d&f=P1&v=2 |
View paging.js
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
//ref https://www.v2ex.com/t/346533#r_4122841 | |
const api = (num) => { | |
const allNum = 3 + parseInt(7 * Math.random());//你不知到总页数的 | |
const quality = 0.15;//接口质量指数 | |
return new Promise((resolve, reject) => { | |
setTimeout(_=>{//超时逻辑 | |
reject({ | |
code: 'CODE_TIMEOUT', | |
msg: 'timeout' |
View gitabbr.fish
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
abbr g git | |
abbr ga 'git add' | |
abbr gaa 'git add --all' | |
abbr gb 'git branch' | |
abbr gbda git\ branch\ --merged\ \|\ command\ grep\ -vE\ \"\^\(\\\*\|\\s\*master\\s\*\\\$\)\"\ \|\ command\ xargs\ -n\ 1\ git\ branch\ -d | |
abbr gbnm 'git branch --no-merged' | |
abbr gbr 'git branch --remote' | |
abbr gc 'git commit -v' | |
abbr gc! 'git commit -v --amend' | |
abbr gca 'git commit -v -a' |
View color.awk
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 awk -f | |
/success/ { print "\033[92m" $0 "\033[0m"; next; } | |
/error/ { print "\033[91m" $0 "\033[0m"; next; } | |
/./ { print $0 } |
View elevator_2.js
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
{ | |
init: function(elevators, floors) { | |
elevators.forEach(initElevator); | |
floors.forEach(initFloor); | |
var topFloor = floors.length - 1; | |
function initElevator(elevator) { | |
elevator.on("idle", function() { | |
}); |
View defer.js
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
function defer() { | |
var resolve, reject; | |
var promise = new Promise(function(realResolve, realReject) { | |
resolve = realResolve; | |
reject = realReject; | |
}); | |
return { | |
resolve: resolve, | |
reject: reject, |
View Paginator.php
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 Paginator implements \IteratorAggregate | |
{ | |
const TPL_WRAPPER = 'wrapper'; | |
const TPL_NUM = 'num'; | |
const TPL_NUM_CURRENT = 'currentNum'; | |
const TPL_TAG = 'tag'; | |
const TPL_NEXT = 'next'; | |
const TPL_PREV = 'prev'; |
View mixins.less
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
.vertical-align-middle(@child: ~".content") { | |
&:before { | |
display: inline-block; | |
content: ''; | |
height: 100%; | |
vertical-align: middle; | |
margin-right: -0.25em; | |
} | |
@{child} { | |
display: inline-block; |
View NotSimpleXMLElement.php
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 NotSimpleXMLElement extends SimpleXMLElement | |
{ | |
const ATTR = 'attr'; | |
const NAME = 'name'; | |
const CHILDREN = 'children'; |
NewerOlder