Skip to content

Instantly share code, notes, and snippets.

Avatar

Izotx izotx

View GitHub Profile
@izotx
izotx / kucoin.py
Created Jul 19, 2018
Kucoin trading bot
View kucoin.py
#importing libraries
from kucoin.client import Client
import json
import math
import time
import datetime
#API KEYS to the exchange
api_key = "xxxxxx"
View Getting Data from Firebase
var firebase = require("firebase");
var RSVP = require('rsvp');
exports.getInstance = function(){
initFirebase()
return firebase
}
/**Responsible for initalizing firebase database.*/
View staticclass.swift
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
Streaming Direct Messages from Twitter
View twitter_stream.py
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 Mar 4, 2016
Example of using NSURLSession
View api.swift
/// 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 Feb 26, 2016
Parsing JSON With Swift
View parsing.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 Sep 21, 2018
Objective-C iBeacon Manager
View JMCBeaconManager.h
//
// 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 Sep 23, 2018
Uploading Image to Server
View upload.swift
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"
View MyFractal.m
#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;
@izotx
izotx / Google Analytics
Last active Dec 21, 2015
Google Analytics How hard is to write it in a right way?
View Google Analytics
//That's a correct version of onLoad method it takes a NSNUmber as a time parameter, not NSTimeInterval.
With prior Google's implementation I couldn't even build the project without warnings or errors.
- (void)onLoad:(NSNumber *)loadTime name:(NSString *)name andLabel:(NSString *)label{
// May return nil if a tracker has not already been initialized with a
// property ID.
id tracker = [[GAI sharedInstance] defaultTracker];
You can’t perform that action at this time.