Skip to content

Instantly share code, notes, and snippets.

View anvarazizov's full-sized avatar

Anvar Azizov anvarazizov

View GitHub Profile
@anvarazizov
anvarazizov / CustomSetter.m
Last active August 29, 2015 14:02
Custom setter features (MUST TO KNOW IT)
// Якщо ми створюємо власний сеттер і щось змінюємо в середині, то треба цю зміну дублювати у ініціалізації. Наприклад:
- (void)setFreeformGrid:(BOOL)freeformGrid
{
if (_freeformGrid != freeformGrid)
{
_freeformGrid = freeformGrid;
self.gridView.isGuidesVisible = _freeformGrid; // Цей шматок коду треба додати і в ініціалізацію, наприклад у метод - commonInit:
}
}
@anvarazizov
anvarazizov / loop1.hs
Created July 25, 2014 12:05
My first loop in Tidal.
bps 1
d1 $ sound "[bd cp, ~ hh*2] [future hh:7/2]"
|+| pan triwave1
|+| accelerate "-1"
d2 $ every 2 (0.25 <~) $ striate 4 (sound "odx:1/2 ~ tabla:3 [feel:4]/2")
d3 $ every 4 (0.5 ~>) $ striate 2 (sound "jvbass jvbass:3 jvbass:6, jvbass:3*3")
|+| shape triwave1
@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;
<?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 / 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);
}
);
@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 / 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 / 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);
- (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 / 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))
}