Skip to content

Instantly share code, notes, and snippets.

View CaliosD's full-sized avatar
🎯
Focusing

Calios CaliosD

🎯
Focusing
  • Ubuntu
View GitHub Profile
@CaliosD
CaliosD / gist:844fde801d7d3bafa11ad1c2f2d68c7c
Created July 8, 2021 06:39 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@CaliosD
CaliosD / rpc.js
Created February 23, 2019 07:59
Some snippets for self testing on local node of IOST blockchain. Feel free to use for testing, and feel free to star🌟if it's useful to you. 🚀
const IOST = require('iost')
const bs58 = require('bs58');
const config = require("./config.dev.json")
/* config.dev.json like this:
{
"rpcURL": "http://localhost:30001",
"privKey": "2yquS3ySrGWPEKywCPzX4RTJugqRh7kJSo5aehsLYPEWkUxBWA39oMrZ7ZxuM4fgyXYs2cPwh5n8aNNpH5x2VyK1"
}
*/
@CaliosD
CaliosD / rpc.js
Created February 23, 2019 07:59
Some snippets for self testing on local node of IOST blockchain. Feel free to use for testing, and feel free to star🌟if it's useful to you. 🚀
const IOST = require('iost')
const bs58 = require('bs58');
const config = require("./config.dev.json")
/* config.dev.json like this:
{
"rpcURL": "http://localhost:30001",
"privKey": "2yquS3ySrGWPEKywCPzX4RTJugqRh7kJSo5aehsLYPEWkUxBWA39oMrZ7ZxuM4fgyXYs2cPwh5n8aNNpH5x2VyK1"
}
*/
@CaliosD
CaliosD / crypto.js
Created February 23, 2019 07:56
Some snippets for self testing on local node of IOST blockchain. Hash and signature functions matched with contract. Feel free to use for testing, and feel free to star🌟if it's useful to you. 🚀
const bs58 = require('bs58');
const { SHA3 } = require('sha3')
const nacl = require('tweetnacl');
const EC = require('elliptic').ec;
const secp = new EC('secp256k1');
const BN = require('bn.js');
const IOST = require('iost')
// equals to `IOSTCrypto.sha3(seed)` in contract
const hash = (seed) => {
@CaliosD
CaliosD / iwallet.js
Last active February 23, 2019 07:59
Some snippets for self testing on local node of IOST blockchain. iwallet is required to install already. Feel free to use for testing, and feel free to star🌟if it's useful to you. 🚀
const shell = require('shelljs')
const fs = require('fs')
const iwallet = 'iwallet --amount_limit "*:unlimited|ram:10000" --gas_limit 3000000 '
// compile js contract to abi
const compile = (path) => {
let cmd = 'iwallet compile ' + path
console.log("👉", cmd)
shell.exec(cmd)
@CaliosD
CaliosD / debounce-throttle.swift
Created January 19, 2018 02:54 — forked from simme/debounce-throttle.swift
Swift 3 debounce & throttle
//
// debounce-throttle.swift
//
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
//
import Foundation
extension TimeInterval {
@CaliosD
CaliosD / CapturedImageSampler.swift
Created November 8, 2017 09:45 — forked from JoshuaSullivan/CapturedImageSampler.swift
The source code for an object that helps you sample RGB values from ARFrames. Save for later use.
//
// CapturedImageSampler.swift
// ARKitTest
//
// Created by Joshua Sullivan on 9/22/17.
// Copyright © 2017 Joshua Sullivan. All rights reserved.
//
import UIKit
import ARKit
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"More" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// maybe show an action sheet with more options
[self.tableView setEditing:NO];
}];
moreAction.backgroundColor = [UIColor lightGrayColor];
UITableViewRowAction *blurAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Blur" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self.tableView setEditing:NO];
}];
@CaliosD
CaliosD / allPropertiesForClass.m
Created May 31, 2017 02:37
Get all properties of given class.
- (NSArray *)allProperties
{
unsigned count;
objc_property_t *properties = class_copyPropertyList([self class], &count);
NSMutableArray *rv = [NSMutableArray array];
unsigned i;
for (i = 0; i < count; i++)
{
@CaliosD
CaliosD / NSString+URLValidate.m
Last active April 12, 2017 07:27
URL validation category for NSString, including both ip and DNS address types.
//
// Created by Calios on 2017-04-10.
// Copyright © 2017 Calios. All rights reserved.
//
@implementation NSString (URLValidate)
- (BOOL)isValidURL
{
if ([self isIPAddress]) {