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
| var lockable = function (func) { | |
| var isLocking = false; | |
| var unlock = function () { | |
| isLocking = false; | |
| }; | |
| return function () { | |
| var args = arguments; | |
| if (isLocking) { | |
| return; | |
| } |
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
| var Lockable = function () { | |
| var exports = {}; | |
| var _locks = {}; | |
| exports.lock = function (name) { | |
| _locks[name] = true; | |
| }; | |
| exports.unlock = function (name) { | |
| _locks[name] = false; |
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
| Backbone.Model.prototype.toJSON = function () { | |
| var result = {}; | |
| _.each(this.attributes, function (val, key) { | |
| if (typeof val === 'undefined') { | |
| result[key] = val; | |
| } else if (typeof val.toJSON === 'function') { | |
| result[key] = val.toJSON(); | |
| } else if (!_.isObject(val)) { | |
| result[key] = val; | |
| } else { |
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
| FOREVER_COMMAND = "node --harmony" | |
| FOREVER_UID = "webapp" | |
| FOREVER_OUTFILE = "./logs/out.log" | |
| FOREVER_ERRFILE = "./logs/err.log" | |
| FOREVER_LOGFILE = "./logs/forever.log" | |
| FOREVER = forever start \ | |
| -c ${FOREVER_COMMAND} \ | |
| --uid ${FOREVER_UID} \ | |
| -l ${FOREVER_LOGFILE} \ |
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
| #!/usr/bin/env node | |
| var co = require('co'); | |
| var parallel = require('co-parallel'); | |
| var globby = require('globby'); | |
| var oss = require('ali-oss'); | |
| var store = oss({ | |
| accessKeyId: process.env.OSS_ACCESS_KEY_ID, | |
| accessKeySecret: process.env.OSS_ACCESS_KEY_SECRET, |
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
| CONFIG_DIR = "./config" | |
| HOSTNAME = "0.0.0.0" | |
| DEBUG = project-name:* | |
| NODE_ENV = production | |
| TARGET_ENV = intranet | |
| DOCKER_IMAGE = your-registry-host.com/your-name/project-name | |
| KUBE_SECRET_NAME = project-name-secret |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>android wx.startRecord NO touchend</title> | |
| <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
| </head> | |
| <body> | |
| <h1>在 Android 微信上 touchstart 时调用 wx.startRecord 会导致不会触发 touchend 事件</h1> | |
| <div> |
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
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: redis-server | |
| # Required-Start: $syslog | |
| # Required-Stop: $syslog | |
| # Should-Start: $local_fs | |
| # Should-Stop: $local_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: redis-server - Persistent key-value db |
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 ENABLE = 'ENABLE' | |
| ;(function () { | |
| if (process.env.PROFILING_HEAPDUMP === ENABLE) { | |
| // heapdump | |
| require('heapdump') | |
| } | |
| if (process.env.PROFILING_MEMORY_STAT === ENABLE) { |
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
| #!/bin/sh | |
| dd if=/dev/zero of=raspberrypi.img bs=1MB count=2500 | |
| parted raspberrypi.img --script -- mklabel msdos | |
| parted raspberrypi.img --script -- mkpart primary fat32 8192s 122879s | |
| parted raspberrypi.img --script -- mkpart primary ext4 122880s -1 | |
| loopdevice=`losetup -f --show raspberrypi.img` | |
| device=`kpartx -va $loopdevice | sed -E 's/.*(loop[0-9])p.*/\1/g' | head -1` | |
| device="/dev/mapper/${device}" | |
| partBoot="${device}p1" |