Skip to content

Instantly share code, notes, and snippets.

View izotx's full-sized avatar

Janusz Chudzynski izotx

View GitHub Profile
@izotx
izotx / .deps...npm...@openzeppelin...contracts...token...ERC20...ERC20.sol
Created December 14, 2021 02:15
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
@izotx
izotx / kucoin.py
Created July 19, 2018 15:00
Kucoin trading bot
#importing libraries
from kucoin.client import Client
import json
import math
import time
import datetime
#API KEYS to the exchange
api_key = "xxxxxx"
var firebase = require("firebase");
var RSVP = require('rsvp');
exports.getInstance = function(){
initFirebase()
return firebase
}
/**Responsible for initalizing firebase database.*/
import UIKit
class DataSource{
//Static method - no need to initialize the instance of the class
class func locations()->[String]{
let a = "a"
let b = "b"
return [a,b]
@izotx
izotx / twitter_stream.py
Created May 4, 2017 02:06
Streaming Direct Messages from Twitter
from twitter import *
import os
import oauth
#Create a new Twitter app first: https://apps.twitter.com/app/new
APP_KEY,APP_SECRET = 'H3kQtN5PQgRiA0ocRCCjqjt2P', '51UaJFdEally81B7ZXjGHkDoDKTYy430yd1Cb0St5Hb1BVcDfE'
# OAUTH_TOKEN, OAUTH_TOKEN_SECRET = '149655407-TyUPMYjQ8VyLNY5p7jq0aMy8PjtFtd7zkIpDh3ZA', 'IUVpiDpoVmdO75UaHOTinAv5TOsAQmddttNENh9ofYuWO'
@izotx
izotx / api.swift
Created March 4, 2016 17:12
Example of using NSURLSession
/// Used to interact with the 2k games server API, and upload images to the server
class APIOperations: NSObject, NSURLSessionDelegate {
/** This method is using just a genereic URLSession to upload image to a server
- Parameters:
- Image: image to upload
- imageType: kind of image (2k type) don't confuse it with png/jpg
- callback: callback that contains information about successful or failed operation
@izotx
izotx / parsing.swift
Created February 26, 2016 21:23
Parsing JSON With Swift
//: Playground - noun: a place where people can play
import UIKit
import XCPlayground
var str = "Hello, playground"
///https://developer.apple.com/library/watchos/recipes/Playground_Help/Chapters/AddResource.html
/**
{ "feed":
{
@izotx
izotx / JMCBeaconManager.h
Last active September 21, 2018 07:06
Objective-C iBeacon Manager
//
// JMCBeaconManager.h
// iBeaconTest
//
/**
* Class that can be used to monitor nearby beacons. To use it you should follow the steps:
1. Check if beacons are supported calling isSupported method
2. Register regions to monitor
3. Specify beaconFound block to monitor beacons.
@izotx
izotx / upload.swift
Last active September 23, 2018 22:58
Uploading Image to Server
static func uploadImage(image:UIImage,token:String, imageType:String, callback:((message:String?, error:String?)->Void))->NSURLSessionTask{
var imageData = UIImagePNGRepresentation(image)
var request = NSMutableURLRequest(URL: NSURL(string:APIKeys.url.rawValue)!)
request.cachePolicy = NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData
var session = NSURLSession.sharedSession()
request.HTTPMethod = "POST"
#import <FFEF/FatFractal.h>
@interface MyFractal : FatFractal
@end
@interface FatFractal()
- (void) setValuesOnObject:(id)obj fromDict:(NSDictionary *)dict loadFromCacheOnly:(BOOL)loadFromCacheOnly
doAutoLoadRefs:(BOOL)doAutoLoadRefs doAutoLoadBlobs:(BOOL)doAutoLoadBlobs;