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
// To enable meta transaction, let create a generic method that calls executeMetaTransaction by taking the user signature | |
// and then execute transaction via Biconomy | |
// Dependencies | |
import {toBuffer} from "ethereumjs-util"; | |
import abi from "ethereumjs-abi"; | |
import events from "events"; | |
// Initialization of web3 | |
let web3 = new Web3(window.ethereum); |
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
Mac Network Commands Cheat Sheet | |
After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty. | |
Get an ip address for en0: | |
ipconfig getifaddr en0 | |
Same thing, but setting and echoing a variable: |
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
// SPDX-License-Identifier: MIT | |
// File: @openzeppelin/contracts/GSN/Context.sol | |
// https://ropsten.etherscan.io/address/0x8df55a60a1c98281a60d6c89f59398bee854fbc8#code | |
pragma solidity ^0.6.0; | |
/* | |
* @dev Provides information about the current execution context, including the | |
* sender of the transaction and its data. While these are generally available | |
* via msg.sender and msg.data, they should not be accessed in such a direct |
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
// time and time end | |
console.time("This"); | |
let total = 0; | |
for (let j = 0; j < 10000; j++) { | |
total += j | |
} | |
console.log("Result", total); | |
console.timeEnd("This"); | |
// Memory |
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
public static DateTime UnixTimestampToDateTime(string unixTimestamp) | |
{ | |
var time = Convert.ToDouble(unixTimestamp); | |
DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); | |
dtDateTime = dtDateTime.AddSeconds(time).ToLocalTime(); | |
return dtDateTime; | |
} |
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
(function ($){ | |
return { | |
property: 'myProperty', | |
method: function(){ | |
return someShit; | |
}, | |
property: 'myProperty2', | |
method: function(){ | |
return someShit2; | |
} |
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
using System; | |
using Android.App; | |
using Android.Content; | |
using Android.Runtime; | |
using Android.Views; | |
using Android.Widget; | |
using Android.OS; | |
using LoginScreen; |
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
public class ConnectionFactory { | |
public static DbConnection GetOpenConnection() { | |
var connection = new SqlConnection("MyConnectionString"); | |
connection.Open(); | |
return connection; | |
} | |
} |
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 sort_by = function() { | |
var fields = [].slice.call(arguments), | |
n_fields = fields.length; | |
return function(A, B) { | |
var a, b, field, key, primer, reverse, result; | |
for (var i = 0, l = n_fields; i < l; i++) { | |
result = 0; | |
field = fields[i]; |
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
//- for testing (logchange) | |
ko.extenders.logChange = function (target, option) { | |
target.subscribe(function (newValue) { | |
console.log(option + " : " + newValue); | |
}); | |
return target; | |
}; | |
ko.bindingHandlers.logger = { |
NewerOlder