Skip to content

Instantly share code, notes, and snippets.

View anvarazizov's full-sized avatar

Anvar Azizov anvarazizov

View GitHub Profile
@anvarazizov
anvarazizov / ExportKindle.js
Created August 3, 2020 20:56 — forked from julians/ExportKindle.js
Amazon Kindle Export
/*
The following data should be run in the console while viewing the page https://read.amazon.com/
It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
modified version of the original script: https://gist.github.com/jkubecki/d61d3e953ed5c8379075b5ddd8a95f22
changes:
* adds a column indicating samples (EBSP)
* updates the database version
* escapes double quotes instead of stripping them
*/
@anvarazizov
anvarazizov / coordinate_systems.swift
Created May 22, 2018 13:20 — forked from phi161/coordinate_systems.swift
Converting Between View Coordinate Systems
import UIKit
import PlaygroundSupport
class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Main view
view.backgroundColor = .black
@anvarazizov
anvarazizov / printTime.swift
Created October 13, 2017 01:03
print time in swift with milliseconds
func printDate(string: String) {
let date = Date()
let formatter = DateFormatter()
formatter.dateFormat = "HH:mm:ss.SSSS"
print(string + formatter.string(from: date))
}
- (void)shareImageToInstagram:(UIImage *)image inView:(UIView *)view
{
NSURL * instagramURL = [NSURL URLWithString:@"instagram://"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
{
NSString * documentDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString * saveImagePath = [documentDirectory stringByAppendingPathComponent:@"Image.igo"];
NSData * imageData = UIImagePNGRepresentation(image);
@anvarazizov
anvarazizov / main.js
Created August 28, 2015 11:40
main file for Cloud code
Parse.Cloud.beforeSave("Photo", function(request, response) {
console.log("version is:" + request.object.get("version"));
var version = request.object.get("version");
if (version == null && version == undefined ) {
version = 0;
}
version += 1;
console.log("version is:" + version);
@anvarazizov
anvarazizov / part of main.js
Last active August 28, 2015 11:42
Parse job example for sending push notification
Parse.Cloud.job("sendPush", function(request, status) {
Parse.Push.send({
channels: ["global"],
data:
{
"alert": "Update process has started",
"content-available":"1",
}
},
{
@anvarazizov
anvarazizov / example.m
Created May 21, 2015 21:07
How to see all fonts in iOS application
NSLog (@"Font families: %@", [UIFont familyNames]);
@anvarazizov
anvarazizov / f3-api-example
Created May 19, 2015 07:59
Fat-free framework JSON API route example
$f3->route('GET /api/user/@id',
function($f3) {
$id = $f3->get('PARAMS.id');
header('Content-Type: application/json');
$data = array('id'=>$id, 'name'=>'Taras', 'lastname'=>'Shevchenko');
echo json_encode($data);
}
);
<?php
$uploaddir = './uploads/';
$file = basename($_FILES['userfile']['name']);
$uploadfile = $uploaddir . $file;
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "http://iphone.zcentric.com/uploads/{$file}";
}
?>
@anvarazizov
anvarazizov / 3-wayQuickSort.m
Last active August 29, 2015 14:05
Поки що не фіналізований метод.
- (void)sortArray:(NSMutableArray *)array withLeft:(NSInteger )left andRight:(NSInteger )right
{
NSInteger i = left - 1;
NSInteger j = right;
NSInteger p = left - 1;
NSInteger q = right;
if (right <= left)
return;