This file contains hidden or 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
| if [[ $create_soft_link == "" ]]; then | |
| cur_dir=$( pwd ) | |
| printf "$cur_dir/setup.sh\n" | |
| ln -s "$cur_dir"/setup.sh /usr/local/bin/setup || printf "${red} create setup link fail${plain}\n" | |
| else | |
| printf "${yellow}Not create setup.sh soft link ${plain}\n" | |
| fi |
This file contains hidden or 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
| find /path/with/files -type f -name "*txt*" -exec ln -s {} . ';' | |
This file contains hidden or 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 couldSendSMS(mobile) { | |
| SMSLog.model.find() | |
| .where('mobile', mobile) | |
| .sort({ expiredate: -1 }) | |
| .limit(1) | |
| .exec( function (err, smsLogs) { | |
| console.log("find ok"); | |
| return (smsLogs[0].expiredate < Date.now()); | |
| }); | |
| } |
This file contains hidden or 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
| let syncFn = x => { | |
| console.log("x is " + x); | |
| if (x < 10) { | |
| syncFn(x + 1); | |
| console.log("x is " + x); | |
| } | |
| } | |
| console.log('=== start sync ==='); | |
| syncFn(2); | |
| console.log('=== end sync ==='); |
This file contains hidden or 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
| let anotherTickFn = x => { | |
| console.log('async', x); | |
| if (x < 10){ | |
| process.nextTick(() => { | |
| anotherTickFn(x + 1); | |
| }); | |
| } | |
| } | |
| console.log('=== start async ==='); |
This file contains hidden or 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
| let cleanRoom = function() { | |
| return new Promise(function(resolve, reject){ | |
| resolve(' Cleaned The Room'); | |
| }); | |
| }; | |
| let removeGarbage = function(message) { | |
| return new Promise(function(resolve, reject){ | |
| resolve(message + ' remove Garbage'); | |
| }); |
This file contains hidden or 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
| // 代码 | |
| const keystone = require('keystone'); | |
| const SMSLog = keystone.list('SMS_log'); | |
| const user = keystone.list('User'); | |
| const Wallet = keystone.list('Wallet'); | |
| exports = module.exports = function (req, res) { | |
| console.log(req.query.id); | |
| const id = req.query.id; |
This file contains hidden or 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
| class Solution: | |
| def isValid(self, s): | |
| """ | |
| :type s: str | |
| :rtype: bool | |
| """ | |
| stack, lookup = [], {"(": ")", "{": "}", "[": "]"} | |
| for par in s: | |
| if par in lookup: | |
| stack.append(par) |
This file contains hidden or 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
| type stack []rune | |
| func (s *stack) push(b rune) { | |
| *s = append(*s, b) | |
| } | |
| func (s *stack) pop() (rune, bool) { | |
| if len(*s) > 0 { | |
| res := (*s)[len(*s)-1] | |
| *s = (*s)[:len(*s)-1] |
This file contains hidden or 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
| func isValid(s string) bool { | |
| stack := []rune{} | |
| for _, b := range s { | |
| switch b { | |
| case '(', '[', '{': | |
| stack = append([]rune{b}, stack...) | |
| default: | |
| if len(stack) > 0 { | |
| c := stack[0]; stack = stack[1:] | |
| switch c { |