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
//NETWORK: RINKEBY | |
// Test code | |
it("listen LogNote event", async function() { | |
let doubleDAIToken = await DAIToken.deployed() | |
let res = await doubleDAIToken.rely(address); | |
console.log(" res: ", res) | |
}) | |
//npm run truffle -- test ./test/TestLogNote.js --network rinkeby |
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
// Decode LogNote | |
// https://github.com/makerdao/dss/blob/6fa55812a5fcfcfa325ad4d9a4d0ca4033c38cab/src/lib.sol | |
// ethers@4 | |
const logNoteAbi = [ | |
{ | |
inputs: [ | |
{ indexed: true, name: 'sig', type: 'bytes4' }, | |
{ indexed: true, name: 'usr', type: 'address' }, | |
{ indexed: true, name: 'arg1', type: 'bytes32' }, |
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 dataCallbacksLeft = data.count | |
func checkDataCompleted() { | |
dataCallbacksLeft -= 1 | |
if dataCallbacksLeft == 0 { | |
// Call major next actions | |
} | |
} | |
asyncFunc() { |
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 tabookey = require('tabookey-gasless'); | |
// step0 | |
const gasPricePercent = 20 | |
relay_client_config = { | |
txfee: 12, | |
force_gasPrice: 2000000000, //override requested gas price | |
force_gasLimit: 4000029, //override requested gas limit. | |
verbose: process.env.DEBUG | |
} |
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 testQueue: OperationQueue = { | |
var queue = OperationQueue() | |
queue.name = "Test queue" | |
queue.maxConcurrentOperationCount = 1 | |
return queue | |
}() | |
for i in 0...200 { |
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
import Foundation | |
import UIKit | |
class UIAnimatedTitleView: UIView { | |
private var label = UILabel() | |
var text: String = "" { | |
didSet { | |
label.text = text | |
label.textColor = UIColor.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
private func initView(completionCallback: (() -> ())? = nil) { | |
var callbacksLeft = 2 | |
func checkCompleted() { | |
callbacksLeft -= 1 | |
if callbacksLeft == 0 { | |
completionCallback?() | |
} | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?xml-stylesheet href="CoreNLP-to-HTML.xsl" type="text/xsl"?> | |
<root> | |
<document> | |
<sentences> | |
<sentence id="1"> | |
<tokens> | |
<token id="1"> | |
<word>Quantum</word> | |
<lemma>Quantum</lemma> |
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
import UIKit | |
let a = 1e+30 | |
let b = -1e+30 | |
let c = 1.0 | |
let sum1 = (a + b) + c | |
let sum2 = a + (b + c) | |
//Representation of floating point value according to IEEE 754 |
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
// Apply mask to credit card number | |
func applyMask(number: String) -> String { | |
let mask = "%2A%2A%2A+%2A%2A%2A%2A+%2A%2A%2A%2A+" | |
let startIndex = number.startIndex | |
let range = startIndex.advancedBy(1) ..< number.endIndex.advancedBy(-4) | |
let substring = number.substringWithRange(range) | |
let replacedWithMask = number.stringByReplacingOccurrencesOfString(substring, withString: mask) | |
return replacedWithMask |
NewerOlder