Skip to content

Instantly share code, notes, and snippets.

View itinance's full-sized avatar

Hagen Hübel itinance

View GitHub Profile

Keybase proof

I hereby claim:

  • I am itinance on github.
  • I am 0xhagen (https://keybase.io/0xhagen) on keybase.
  • I have a public key ASARlo5l0K4VorTL-WRlEp-8D7DkfnXBEqoIyWL6PCMqeQo

To claim this, I am signing this object:

@itinance
itinance / tokenUri.js
Created January 27, 2022 17:37
Execute tokenURI-method on ERC721-contract
const ethers = require('ethers');
const API_KEY = 'YOUR_INFURA_APIKEY';
// The Contract interface
const abi = [
"function tokenURI(uint256 _tokenId) external view returns (string)",
];
// the contract interface
const contractAddress = "0x2f3ee0ace02c71bc82863a28633c0f983a5435bb";
@itinance
itinance / README.md
Created May 25, 2021 23:42
What is composer doing here?

Doing stuff in a terminal:

mkdir test
cd test
php -d memory_limit=-1 /usr/local/bin/composer require sylius/sylius

The output contains the following lines:

@itinance
itinance / Makefile
Created April 11, 2020 21:24
REST-API Dockerfile
# (C) 2020 Hagen Huebel, ITinance GmbH https://itinance.com, dedified GmbH https://dedified.io
# All rights reserved.
VersionFile=VERSION
VERSION=`cat $(VersionFile)`
start:
docker-compose up -d
stop:
@itinance
itinance / fix-swaggger-files.sh
Created April 11, 2020 21:20
Fix Swagger Files
#!/usr/bin/env bash
# (C) 2020 Hagen Huebel, ITinance GmbH https://itinance.com, dedified GmbH https://dedified.io
# All rights reserved.
# fix-swagger-models
# swaggo/swag has a bug that will prevent renaming of Models from "model.Account" ino "Account"
# we are going to fix this generation with this command
# the "-i ''" is a fix for sed required on Mac to avoid the auto-creation of backup-files
func getExistingAddressId(tx *sql.Tx, address string) (int64, error) {
var result sql.NullInt64
if err := tx.QueryRow("SELECT id FROM wallet WHERE `address`=?", address).
Scan(&result); err != nil && err != sql.ErrNoRows {
return 0, err
}
return result.Int64, nil
}
@itinance
itinance / ComplicationController.m
Created April 15, 2019 11:07
getCurrentTimelineEntryForComplication
#pragma mark - Timeline Population
- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimelineEntry * __nullable))handler {
ExtensionDelegate* myDelegate = (ExtensionDelegate*)[[WKExtension sharedExtension] delegate];
if (complication.family == CLKComplicationFamilyModularSmall) {
[myDelegate fetchRate:^(NSDictionary * data, NSError * _Nullable error) {
@itinance
itinance / ComplicationController.m
Created April 15, 2019 11:04
getLocalizableSampleTemplateForComplication
#pragma mark - Placeholder Templates
- (void)getLocalizableSampleTemplateForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTemplate * __nullable complicationTemplate))handler {
// This method will be called once per supported complication, and the results will be cached
if(complication.family == CLKComplicationFamilyModularSmall) {
CLKComplicationTemplateModularSmallSimpleText* template = [[CLKComplicationTemplateModularSmallSimpleText alloc] init];
template.textProvider = [CLKSimpleTextProvider textProviderWithText:@"10.000"];
handler(template);
} else if(complication.family == CLKComplicationFamilyModularLarge) {
@itinance
itinance / k
Last active November 1, 2017 18:35
/usr/local/bin/k : kills Xcode and any react native packager including visual studio code
killall node
killall Terminal
killall Xcode
kill -9 $(pgrep Electron)
kill -9 $(pgrep Simulator)
@itinance
itinance / package.json
Last active March 21, 2021 14:12
React Native: package.json: usefully tools for React Native that can be used with "npm run $name"
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start --reset-cache",
"reset": "rm -rf node_modules/ && npm cache clear && watchman watch-del-all && npm i",
"testflight": "fastlane beta",
"android-device": "adb reverse tcp:8081 tcp:8081 && react-native run-android",
"lint": "jslint **.js",
"test": "jest",
"generate-apk": "cd android && ./gradlew assembleRelease && open ./app/build/outputs/apk/",
"install-apk": "cd android && ./gradlew installRelease"
},