This file contains 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://webapps.stackexchange.com/questions/39587/view-estimated-size-of-github-repository-before-cloning | |
# tested on macOS | |
echo https://github.com/torvalds/linux.git | perl -ne 'print $1 if m!([^/]+/[^/]+?)(?:\.git)?$!' | xargs -I{} curl -s -k https://api.github.com/repos/'{}' | grep size | |
# output: | |
# "size": 1746294, |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Free Share Calc</title> | |
</head> | |
<body> | |
Calc to calculate the profit required to get 1 free stock/share |
This file contains 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
UIView.animateKeyframes(withDuration: 5, //1 | |
delay: 0, //2 | |
options: .calculationModeLinear, //3 | |
animations: { //4 | |
UIView.addKeyframe( //5 | |
withRelativeStartTime: 0.25, //6 | |
relativeDuration: 0.25) { //7 | |
self.button.center = CGPoint(x: self.view.bounds.midX, y: self.view.bounds.maxY) //8 | |
} |
This file contains 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
var dynamicAnimator : UIDynamicAnimator! | |
var gravityBehavior : UIGravityBehavior! | |
var collisionBehavior : UICollisionBehavior! | |
var bouncingBehavior : UIDynamicItemBehavior! | |
dynamicAnimator = UIDynamicAnimator(referenceView: self.view) //1 | |
gravityBehavior = UIGravityBehavior(items: [button]) //2 | |
dynamicAnimator.addBehavior(gravityBehavior) //3 |
This file contains 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
var dynamicAnimator : UIDynamicAnimator! | |
var gravityBehavior : UIGravityBehavior! | |
var collisionBehavior : UICollisionBehavior! | |
dynamicAnimator = UIDynamicAnimator(referenceView: self.view) //1 | |
gravityBehavior = UIGravityBehavior(items: [button]) //2 | |
dynamicAnimator.addBehavior(gravityBehavior) //3 | |
collisionBehavior = UICollisionBehavior(items: [button]) //4 |
This file contains 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
var dynamicAnimator : UIDynamicAnimator! | |
var gravityBehavior : UIGravityBehavior! | |
dynamicAnimator = UIDynamicAnimator(referenceView: self.view) //1 | |
gravityBehavior = UIGravityBehavior(items: [button]) //2 | |
dynamicAnimator.addBehavior(gravityBehavior) //3 |
This file contains 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
let newButtonWidth: CGFloat = 60 | |
let animator = UIViewPropertyAnimator(duration:0.3, curve: .linear) { //1 | |
self.button.frame = CGRect(x: 0, y: 0, width: newButtonWidth, height: newButtonWidth) | |
self.button.center = self.view.center | |
} | |
animator.startAnimation() //2 |
This file contains 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
let newButtonWidth: CGFloat = 60 | |
UIView.animate(withDuration: 1.0, //1 | |
delay: 0.0, //2 | |
usingSpringWithDamping: 0.3, //3 | |
initialSpringVelocity: 1, //4 | |
options: UIView.AnimationOptions.curveEaseInOut, //5 | |
animations: ({ //6 | |
self.button.frame = CGRect(x: 0, y: 0, width: newButtonWidth, height: newButtonWidth) | |
self.button.center = self.view.center | |
}), completion: nil) |
This file contains 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
let oldValue = button.frame.width/2 | |
let newButtonWidth: CGFloat = 60 | |
/* Do Animations */ | |
CATransaction.begin() //1 | |
CATransaction.setAnimationDuration(2.0) //2 | |
CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)) //3 | |
// View animations //4 | |
UIView.animate(withDuration: 1.0) { |
This file contains 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
let newButtonWidth: CGFloat = 60 | |
UIView.animate(withDuration: 2.0) { //1 | |
self.button.frame = CGRect(x: 0, y: 0, width: newButtonWidth, height: newButtonWidth) //2 | |
self.button.center = self.view.center //3 | |
} |
NewerOlder