Skip to content

Instantly share code, notes, and snippets.

View zabirauf's full-sized avatar
👨‍💻
I may be slow to respond.

Zohaib Rauf zabirauf

👨‍💻
I may be slow to respond.
View GitHub Profile
@zabirauf
zabirauf / UpgradeableContractProxy.sol
Last active April 16, 2018 01:00
Example of a ethereum smart contract that can be upgraded
pragma solidity ^0.4.21;
import "./Ownable.sol";
contract UpgradeableContractProxy is Ownable {
address private _currentImplementation;
function UpgradeableContractProxy() public Ownable() {
}
pragma solidity ^0.4.15;
import "truffle/Assert.sol";
import { StringToUintMap } from "../libraries/StringToUintMap.sol";
contract TestStringToUintMap {
StringToUintMap.Data private _stringToUintMapData;
function testInsertNewKey() {
// Arrange
module.exports = {
networks: {
development: {
host: "localhost", // Ganache RPC server URL
port: 7545, // Ganache RPC server Port
network_id: "*" // Match any network id
}
}
};
const StringToUintMap = artifacts.require("./StringToUintMap.sol");
const PersonsAge = artifacts.require("./PersonsAge.sol");
module.exports = function(deployer) {
deployer.deploy(StringToUintMap);
deployer.link(StringToUintMap, PersonsAge);
deployer.deploy(PersonsAge);
};
// Code for PersonsAge.sol
pragma solidity ^0.4.15;
import { StringToUintMap } from "../libraries/StringToUintMap.sol";
contract PersonsAge {
StringToUintMap.Data private _stringToUintMapData;
// Code for StringToUintMap.sol
pragma solidity ^0.4.15;
library StringToUintMap {
struct Data {
mapping (string => uint8) map;
}
function insert(
@zabirauf
zabirauf / init.vim
Last active February 16, 2022 21:01
Neovim configuration
call plug#begin()
" Autocompletion
Plug 'roxma/nvim-completion-manager'
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --racer-completer --omnisharp-completer --tern-completer' }
Plug 'ervandew/supertab'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Buffer

Keybase proof

I hereby claim:

  • I am zabirauf on github.
  • I am zabirauf (https://keybase.io/zabirauf) on keybase.
  • I have a public key ASARuUOjzzy29X8HMZTWPwaznADwtY2m8LXL_HshE-64-Ao

To claim this, I am signing this object:

function append(
arrOrNum: number | number[],
toAppendArrOrNum: number | number[]): number[] {
if (!Array.isArray(arrOrNum)) {
arrOrNum = [arrOrNum];
}
if (!Array.isArray(toAppendArrOrNum)) {
toAppendArrOrNum = [toAppendArrOrNum];
function append(arrOrNum, toAppendArrOrNum) {
if (!Array.isArray(arrOrNum)) {
arrOrNum = [arrOrNum];
}
if (!Array.isArray(toAppendArrOrNum)) {
toAppendArrOrNum = [toAppendArrOrNum];
}
return arrOrNum.concat(toAppendArrOrNum);