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
Wind.Async.Binding.fromCallbackAndNext = (function(original) { | |
// return functionAsync(arg1, arg2, ..., AsyncMethod) | |
return (function() { | |
var asyncArgs = arguments; // (arg1, arg2, ..., AsyncMethod) | |
if (asyncArgs < 1) return; | |
var asyncMethod = asyncArgs[asyncArgs.length - 1]; |
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 program = require('commander'); | |
var Wind = require('wind'), | |
Binding = Wind.Async.Binding; | |
//Wind.logger.level = Wind.Logging.Level.WARN; | |
program.chooseAsync = Binding.fromCallback(program.choose); | |
/*program.chooseAsync = Binding.fromCallback(function(list, fn) { |
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 mongoose = require('mongoose') | |
mongoose.connect('mongodb://localhost/mydb', function () { | |
console.log('mongodb connected') | |
}) |
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 b = require('./b') | |
console.log(b.val) | |
process.nextTick(function () { | |
var c = require('./c') | |
console.log(b.val) | |
}) |
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 StringBuilder () { | |
this._strings = [] | |
} | |
StringBuilder.prototype.append = function (str) { | |
this._strings.push(str) | |
} | |
StringBuilder.prototype.toString = function () { | |
return this._strings.join('') |
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 router = require('xx').router | |
, marked = require('marked') | |
exports.create = router() | |
.shouldAuthed() | |
.shouldNotContains([ 'id', 'creator' ]) | |
exports.show = router() | |
.visable([ 'title', 'content' ]) | |
.map('content', marked.render) |
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
; glass::NativeEyeGestureService::isGestureSupported(int) const | |
push {r4, r5, r6, lr} ; XREF=0x483c | |
mov r4, r0 | |
ldr r0, = 0x2bb4 | |
mov r5, r1 | |
add r0, pc | |
ldr r0, [r0] | |
blx 0x38ac | |
ldr r4, [r4, #0xc] | |
cbz r4, 0x4808 |
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
String enabledNotificationListeners = Settings.Secure.getString(context.getContentResolver(), "enabled_notification_listeners"); | |
// check to see if the enabledNotificationListeners String contains our package name | |
if (enabledNotificationListeners == null || !enabledNotificationListeners.contains(context.getPackageName())) { | |
// in this situation we know that the user has not granted the app the Notification access permission | |
throw new Exception(); | |
} else { | |
doSomethingThatRequiresNotificationAccessPermission(); | |
} |
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
<!DOCTYPE html> | |
<html lang="zh-cn"> | |
<head> | |
<title>出口资讯</title> | |
<meta charset="utf8"> | |
<style> | |
body { | |
margin: 0; | |
padding: 0 100px; | |
background: black; |
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
#!/bin/sh | |
YELLOW="\033[33m" | |
PINK="\033[36m" | |
RESET="\033[0m" | |
echo "$PINK Extracting $1...$RESET" | |
zip=$1 | |
rom=${zip%.*} | |
mkdir $rom |
OlderNewer