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
| Copyright [yyyy] [name of copyright owner] | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software | |
| distributed under the License is distributed on an "AS IS" BASIS, |
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 MD5 = function() { | |
| var crypto = require('crypto'); | |
| return { | |
| hex: function(src) { | |
| var md5 = crypto.createHash('md5'); | |
| md5.update(src, 'utf8'); | |
| return md5.digest('hex'); | |
| } | |
| }; | |
| }; |
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 getQuery = function() { | |
| var result = {}; | |
| if(location.href.indexOf('?') == -1) return result; | |
| var lastIndex = location.href.indexOf('#') != -1 ? location.href.indexOf('#') : location.href.length; | |
| var kvs = location.href.slice(location.href.indexOf('?') + 1, lastIndex).split('&'); | |
| for(var i = 0; i < kvs.length; i++) { | |
| var kv = kvs[i].split('='); | |
| result[kv[0]] = kv[1]; | |
| } | |
| return result; |
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 replaceAll = function(org, before, after){ return org.split(before).join(after); }; |
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 zerofill = function(num, zeros) { return (Array(zeros).join('0') + num).slice(-zeros); }; |
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 loadFromFile = function(file, callback) { | |
| if(!file || file.trim().length == 0) { | |
| callback('file not found', null); | |
| return; | |
| } | |
| callback(null, ("" + require('fs').readFileSync(file))); | |
| }; | |
| var loadFromPipe = function(callback) { | |
| var text = ""; |
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
| { | |
| "100": "Continue", | |
| "101": "Switching Protocols", | |
| "102": "Processing", | |
| "200": "OK", | |
| "201": "Created", | |
| "202": "Accepted", | |
| "203": "Non-Authoritative Information", | |
| "204": "No Content", | |
| "205": "Reset Content", |
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
| Intent intent = new Intent(); | |
| intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | |
| intent.setData(Uri.parse("package:com.your.app")); | |
| startActivity(intent); |
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 getRolledThicklyDirection = function(year) { | |
| var directions = [ | |
| "西南西微西", | |
| "南南東微南", | |
| "北北西微北", | |
| "南南東微南", | |
| "東北東微東" | |
| ]; | |
| return directions[year % 5]; | |
| }; |
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
| /* global process: false */ | |
| var logger = (function(){ | |
| var COLOR = { | |
| RED: '\u001b[31m', | |
| RESET: '\u001b[0m' | |
| }; | |
| return { | |
| log: function(){ console.log.apply(console, arguments); }, | |
| error: function() { | |
| arguments[0] = COLOR.RED + arguments[0]; |