Skip to content

Instantly share code, notes, and snippets.

View AlexEdunov's full-sized avatar

Alexander Edunov AlexEdunov

  • MOIA GmbH
  • Berlin, Germany
View GitHub Profile
@dannote
dannote / final-cut-pro-trial-reset.swift
Last active July 21, 2024 22:00
Final Cut Pro X trial reset
#!/usr/bin/swift
import Foundation
let path = URL(fileURLWithPath: NSString(string: "~/Library/Application Support/.ffuserdata").expandingTildeInPath)
let data = try! NSData(contentsOf: path) as Data
let dictionary = try! NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as! NSDictionary
let mutableDictionary = dictionary.mutableCopy() as! NSMutableDictionary
for (key, value) in mutableDictionary {
@jaumevn
jaumevn / compression.swift
Last active May 17, 2021 16:57
Video Compression in Swift
func compress(videoPath : String, exportVideoPath : String, renderSize : CGSize, completion : (Bool) -> ()) {
let videoUrl = NSURL(fileURLWithPath: videoPath)
if (!existsFileAtUrl(videoUrl)) {
completion(false)
return
}
let videoAssetUrl = AVURLAsset(URL: videoUrl, options: nil)
@scottdelly
scottdelly / FacebookLogin.swift
Last active April 23, 2021 21:43
Facebook Login with iOS SDK 4.0 in Swift
//If you have a Bridging-Header:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
//In your AppDelegate:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [String: AnyObject]?) -> Bool {
//App launch code
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
//Optionally add to ensure your credentials are valid:
@hlung
hlung / iOS - constants declaration.m
Last active November 25, 2015 07:41
iOS - how to create constants in private and public scope
// ----------------------------------
//declaration in PRIVATE scope (for using only in your class)
// ----------------------------------
// declare in .m
static const int kTweetMaxCharacters = 140;
static NSString * const kHelloString = @"HELLO!";
// ----------------------------------
// declaration in PUBLIC scope (for using in other classes too)
// ----------------------------------
@zenkay
zenkay / gist:3237860
Created August 2, 2012 15:19
Installation tips for RVM/Ruby on OSX 10.8 Mountain Lion

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

@andrewsardone
andrewsardone / gist:1367501
Created November 15, 2011 16:27
Objective-C @Property declaration cheat sheet – http://git.io/objcproperty

@property(<atomicity>, <writability>, <setter semantics>)

<atomicity>

nonatomic – Specifies that accessors are nonatomic. By default, accessors are atomic.

<writability>

readwrite – Indicates that the property should be treated as read/write. This attribute is the default.

@artero
artero / launch_sublime_from_terminal.markdown
Last active May 15, 2024 03:38 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation