Skip to content

Instantly share code, notes, and snippets.

View Narmo's full-sized avatar
🔥
Wake up and smell the ashes.

Nikita Denin Narmo

🔥
Wake up and smell the ashes.
View GitHub Profile
{
"Simulator Target Bundle": "com.bundle.id",
"aps": {
"alert": "Text to show in notification",
"sound": "default",
"badge": 1
},
"custom_param_1": "value",
"custom_param_2": "value"
}
/**
* File: RandomImage.java
*
* Description:
* Create a random color image.
*
* @author Yusuf Shakeel
* URL: https://www.dyclassroom.com/image-processing-project/how-to-create-a-random-pixel-image-in-java
* Date: 01-04-2014 tue
*/
@Narmo
Narmo / PSPDFUIKitMainThreadGuard.m
Last active January 28, 2016 16:00 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
@Narmo
Narmo / autoincrement.sh
Last active November 16, 2015 16:21
Autoincrement Xcode project build version
# Set project "Version" string (e.g. 1.1)
# After each build "Build" string will be composed from "Version" and incremented build version (1.1.32, 1.1.33 and so on).
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}")
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}")
buildNumber=$(echo $buildNumber | awk -F. '{print $NF}')
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $versionNumber.$buildNumber" "${INFOPLIST_FILE}"
@Narmo
Narmo / ExternalMaps.m
Last active August 29, 2015 14:26
Open location in external maps app (iOS)
/**
Open location in one of external maps app: Google Maps, Yandex.Navigator, Yandex.Maps, Maps (iOS)
@param location Coordinates in following format: "xx.yyy,xx.yyy" (longitude,latitude)
*/
+ (void)openLocation:(NSString *)location {
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
NSArray *coordinatesComponents = [location componentsSeparatedByString:@","];
CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake([coordinatesComponents[0] doubleValue], [coordinatesComponents[1] doubleValue]);
NSString *googleMapsUrlString = [NSString stringWithFormat:@"comgooglemaps://?q=%@", location];
@Narmo
Narmo / install-comodo-ssl-cert-for-nginx.rst
Last active August 29, 2015 14:26 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@Narmo
Narmo / yamaps.m
Last active December 11, 2015 09:48
Как проверить, установлены ли Яндекс.Карты на устройстве с iOS, и открыть их с отцентрированной точкой и маркером в этой точке.
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"yandexmaps://test"]]) {
CLLocationCoordinate2D location = <some location>;
NSString *yaMapsString = [NSString stringWithFormat:@"yandexmaps://maps.yandex.ru/?pt=%f,%f&ll=%f,%f", location.longitude, location.latitude, location.longitude, location.latitude];
NSURL *yamapsUrl = [NSURL URLWithString:yaMapsString];
[[UIApplication sharedApplication] openURL:yamapsUrl];
}