Skip to content

Instantly share code, notes, and snippets.

@Abhishek9634
Abhishek9634 / UIImage+Rotation.swift
Created March 13, 2019 14:16 — forked from norsez/UIImage+Rotation.swift
Rotate UIImage by radians in Swift 3
extension UIImage {
func image(withRotation radians: CGFloat) -> UIImage {
let cgImage = self.cgImage!
let LARGEST_SIZE = CGFloat(max(self.size.width, self.size.height))
let context = CGContext.init(data: nil, width:Int(LARGEST_SIZE), height:Int(LARGEST_SIZE), bitsPerComponent: cgImage.bitsPerComponent, bytesPerRow: 0, space: cgImage.colorSpace!, bitmapInfo: cgImage.bitmapInfo.rawValue)!
var drawRect = CGRect.zero
drawRect.size = self.size
let drawOrigin = CGPoint(x: (LARGEST_SIZE - self.size.width) * 0.5,y: (LARGEST_SIZE - self.size.height) * 0.5)
internal let DEFAULT_MIME_TYPE = "application/octet-stream"
internal let mimeTypes = [
"html": "text/html",
"htm": "text/html",
"shtml": "text/html",
"css": "text/css",
"xml": "text/xml",
"gif": "image/gif",
"jpeg": "image/jpeg",
@Abhishek9634
Abhishek9634 / README.md
Created December 28, 2018 11:46 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@Abhishek9634
Abhishek9634 / CountryCodes.json
Created December 12, 2018 10:44 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
@Abhishek9634
Abhishek9634 / countries.json
Created December 12, 2018 10:44 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@Abhishek9634
Abhishek9634 / git_error_solution.md
Created April 16, 2018 07:21 — forked from johnsolk/git_error_solution.md
git error, fatal: HTTP request failed

Got this error message:


[ljcohen@dev-intel16 Porites_astreoites_larvae_salinity]$ git push origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/ljcohen/Porites_astreoites_larvae_salinity.git/info/refs

fatal: HTTP request failed

Googled problem and found this:

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@Abhishek9634
Abhishek9634 / sublime-command-line.md
Created January 30, 2018 02:32 — forked from adrianorsouza/sublime-command-line.md
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

swagger: "2.0"
info:
version: 1.0.0
title: Zumba's API
description: Documentation about Zumba's API.
contact:
name: Zumba Engineering Team
email: engineering@zumba.com
url: https://tech.zumba.com
host: apiv3.zumba.com
@Abhishek9634
Abhishek9634 / gist:9db02bf2aea3c05f7216d0d42c4cdb64
Created April 3, 2017 13:45 — forked from jeffreycamealy/gist:5104279
Urban Airship AppDelegate initialization code
#import "UAirship.h"
#import "UAPush.h"
============================
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self setupUrbanAirshipForApplication:application withLaunchOptions:launchOptions];
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application {