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
getMachineID = function () { | |
var storedMacId = ""; | |
chrome.storage.local.get('machine-id', function (item) { | |
storedMacId = item['machine-id']; | |
console.log("tmp id = " + storedMacId) | |
if (!storedMacId) { | |
console.log("before get " + storedMacId) | |
//storedMacId = getIdFromServer() | |
storedMacId = guid(); |
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
localStorage.clear(); | |
function s4() { | |
return Math.floor((1 + Math.random()) * 0x10000) | |
.toString(16) | |
.substring(1); | |
}; | |
function guid() { | |
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + |
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
Error in response to storage.get: TypeError: undefined is not a function | |
at process (chrome-extension://glfeiaclnnengimjmnoigoppoedcnoeo/content.js:119:26) | |
at HTMLDocument.<anonymous> (chrome-extension://glfeiaclnnengimjmnoigoppoedcnoeo/content.js:170:5) | |
at jQuery.Callbacks.fire (chrome-extension://glfeiaclnnengimjmnoigoppoedcnoeo/jquery-1.11.0.js:3099:30) | |
at Object.jQuery.Callbacks.self.fireWith [as resolveWith] (chrome-extension://glfeiaclnnengimjmnoigoppoedcnoeo/jquery-1.11.0.js:3211:7) | |
at Function.jQuery.extend.ready (chrome-extension://glfeiaclnnengimjmnoigoppoedcnoeo/jquery-1.11.0.js:3423:13) | |
at completed (chrome-extension://glfeiaclnnengimjmnoigoppoedcnoeo/jquery-1.11.0.js:3453:10) extensions::sendRequest:26 | |
safeCallbackApply extensions::sendRequest:26 | |
handleResponse |
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
Data: | |
user url | |
1 www.twitter | |
2 www.yahoo.com | |
1 www.google.com | |
1 www.twitter.com | |
Output: | |
1 www.twitter.com:2,www.google.com:1 | |
2 www.yahoo.com |
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
case class RichDate(val timestamp: Long) extends AnyVal with Ordered[RichDate] { | |
//case class RichDate(val timestamp: Long) extends Ordered[RichDate] { | |
// these are mutable, don't keep them around | |
def value: Date = new java.util.Date(timestamp) | |
def +(interval: Duration) = interval.addTo(this) | |
def -(interval: Duration) = interval.subtractFrom(this) | |
//Inverse of the above, d2 + (d1 - d2) == d1 |
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
post "/retailers/#{retailer_id}/orders", | |
{:order => {:retailer_id => retailer_id, :product_ids_with_quantities => [[2, 1],[2, 1]]}}.to_json, | |
{:Authorization => token} | |
打印params的话 | |
{"order"=>{"retailer_id"=>"1", "product_ids_with_quantities"=>["2", "1", "2", "1"]}, "format"=>:json, "controller"=>"api/v1/orders", "action"=>"create", "retailer_id"=>"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
{ | |
"indexId": "c92ca3ba-c0d4-430a-8b60-d8206abdaa6c", | |
"indexName": "abc_changed", | |
"searchableFields": [ | |
"f1", | |
"f2" | |
], | |
"appId": "66ee0924-cb4d-4934-8712-0d3ebf77d59f", | |
"rankers": [ | |
{ |
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
功能需求非常简单 | |
我会手动打开github的搜索页面,比如: | |
https://github.com/search?q=location%3Ashanghai | |
此时提供一个按钮让插件做以下操作: | |