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 watchEtherTransfers() { | |
// Instantiate web3 with WebSocket provider | |
const web3 = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws')) | |
// Instantiate subscription object | |
const subscription = web3.eth.subscribe('pendingTransactions') | |
// Subscribe to pending transactions | |
subscription.subscribe((error, result) => { | |
if (error) console.log(error) |
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
@interface NSObject (Debounce) | |
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay; | |
@end |
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 confirmEtherTransaction(txHash, confirmations = 10) { | |
setTimeout(async () => { | |
// Get current number of confirmations and compare it with sought-for value | |
const trxConfirmations = await getConfirmations(txHash) | |
console.log('Transaction with hash ' + txHash + ' has ' + trxConfirmations + ' confirmation(s)') | |
if (trxConfirmations >= confirmations) { | |
// Handle confirmation event according to your business logic |
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
// https://gist.github.com/1964797 | |
var express = require('express'); | |
var sys = require('util'); | |
var oauth = require('oauth'); | |
var app = express(); | |
var _twitterConsumerKey = 'sLNC1nUodJom3L8BNL4iHA'; | |
var _twitterConsumerSecret = 'EcO8Iiv5M8R0qeLVbHAi2cm9uX4Fp1jPODnoGfqUEro'; |
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 watchTokenTransfers() { | |
// Instantiate web3 with WebSocketProvider | |
const web3 = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws')) | |
// Instantiate token contract object with JSON ABI and address | |
const tokenContract = new web3.eth.Contract( | |
TOKEN_ABI, process.env.TOKEN_CONTRACT_ADDRESS, | |
(error, result) => { if (error) console.log(error) } | |
) |
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
PHFetchResult *result = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum | |
subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary | |
options:nil]; | |
PHAssetCollection *assetCollection = result.firstObject; | |
NSLog(@"%@", assetCollection.localizedTitle); | |
// Camera Roll |
NewerOlder