This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) { | |
super.didUpdateFocus(in: context, with: coordinator) | |
let duration = UIView.inheritedAnimationDuration * 2 | |
UIView.animate(withDuration: duration, delay: 0, options: [.overrideInheritedDuration, .overrideInheritedCurve], animations: { [weak self] in | |
self?.layoutIfNeeded() | |
}, completion: nil) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
class Person: CustomDebugStringConvertible { | |
let name: String | |
init(name: String) { | |
self.name = name | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import XCPlayground | |
import QuartzCore | |
extension UIImage { | |
class func imageWithLabel(label: UILabel) -> UIImage { | |
UIGraphicsBeginImageContextWithOptions(label.bounds.size, false, 0.0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
public class Solution { | |
static class Operation { | |
public int a; | |
public int b; | |
public int k; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.splitSpacesAsInts = function() { | |
return this.split(" ").map(function(aNum) { return parseInt(aNum); }); | |
}; | |
function processData(input) { | |
var lines = input.split("\n"); | |
var first = lines[0].splitSpacesAsInts(); | |
var n = first[0]; | |
var m = first[1]; | |
var ops = lines.slice(1).map(function(line) { return line.splitSpacesAsInts(); }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html | |
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version":"2012-10-17", | |
"Statement":[{ | |
"Sid": "AddPerm", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": ["s3:GetObject"], | |
"Resource": [ | |
"arn:aws:s3:::bucket-name/*" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSTALLING FFMPEG ON EC2 | |
I just received this excellent how-to from AWS Support and it worked for me on my Amazon Linux AMI release 2013.09. It would probably work this way for any Linux distribution | |
1. SSH into your instance and become root | |
sudo su - | |
2. Go to the the /usr/local/bin directory | |
cd /usr/local/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Treebank Parser tag definitions | |
# https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html | |
# | |
# Triplet Extraction paper | |
# http://ailab.ijs.si/dunja/SiKDD2007/Papers/Rusu_Trippels.pdf | |
import json | |
ADJECTIVE_TYPES = ["JJ", "JJR", "JJS"] | |
NOUN_TYPES = ["NN", "NNP", "NNPS", "NNS"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainController: UIViewController { | |
@IBOutlet weak var captureButton: UIView? | |
let BORDER_WIDTH:CGFloat = 4 | |
let RADIUS_MULTIPLIER:CGFloat = 0.5 | |
let BUTTON_COLOR = UIColor.redColor().CGColor | |
let BUTTON_PRESSED_COLOR = UIColor.whiteColor().CGColor | |
let INNER_BUTTON_OFFSET = 0.4 |