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
self.randomNum = arc4random_uniform(15) // range | |
self.someInt = Int(self.randomNum!) | |
self.someDouble = Double(self.someInt!) / 10 | |
self.someCMTime = CMTime(seconds: someDouble!, preferredTimescale: 90000) | |
debugPrint(self.player.currentItem!.asset.duration) | |
if ((self.someCMTime?.seconds)! > self.player.currentItem!.asset.duration.seconds) { | |
debugPrint("too much!") | |
} else { |
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 timeAtPress: NSDate! | |
var timeElapsed: NSDate! | |
// presses began | |
self.timeAtPress = NSDate() | |
print("timeAtPress \(self.timeAtPress as Date)") | |
// presses ended |
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
override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { | |
if(presses.first?.type == UIPressType.upArrow) { | |
debugPrint("up arrow began") | |
} else if(presses.first?.type == UIPressType.downArrow) { | |
debugPrint("down arrow began") | |
} | |
} | |
override func pressesEnded(_ presses: Set<UIPress>, with event: UIPressesEvent?) { | |
if(presses.first!.type == UIPressType.upArrow) { |
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
override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { | |
debugPrint("woo") | |
var restartTimer = true | |
if let gotEvents = event?.allPresses { | |
// At least one touch in progress? Do not restart timer, just invalidate it | |
for gotEvent in gotEvents.enumerated() { | |
if gotEvent.element.phase != .cancelled && gotEvent.element.phase != .ended { | |
restartTimer = false |
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
def classes(self): | |
""" | |
Quick detection to see if it's a chronicle, since we don't differentiate any other way as of now. Should be expanded to all chronicle articles, not just current series. This was initially to allow for conditional styling (block level elements such as blockquote at the beginning of article weren't displaying correctly with "star" voting block) | |
""" | |
classes = [] | |
if self.is_current_series: | |
classes.append("chronicle") |
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
import * as React from "react"; | |
import { PropertyControls, ControlType, Rect } from "framer"; | |
const style: React.CSSProperties = { | |
height: "100%", | |
display: "flex", | |
alignItems: "center", | |
justifyContent: "center", | |
textAlign: "center", | |
color: "#8855FF", |
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
if let url = Bundle.main.url(forResource:"Channels", withExtension: "plist") { | |
do { | |
var data = try Data(contentsOf:url) | |
let swiftDictionary = try PropertyListSerialization.propertyList(from: data, options: [], format: nil) as! [String:Any] | |
// do something with the dictionary | |
// debugPrint(swiftDictionary) | |
for (key, values) in swiftDictionary { | |
print(key) | |
} |
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
UIGraphicsBeginImageContext(self.frame.size) | |
let ctx = UIGraphicsGetCurrentContext()! | |
self.layer.render(in: ctx) | |
let img = UIGraphicsGetImageFromCurrentImageContext()! | |
UIGraphicsEndImageContext() |
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
package com.example.domingl.lottietest; | |
import android.animation.Animator; | |
import android.animation.Animator.AnimatorListener; | |
import android.os.Handler; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import com.airbnb.lottie.LottieAnimationView; |
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
// MARK: UIPageViewControllerDataSource | |
extension PageViewController: UIPageViewControllerDataSource { | |
func pageViewController(_ pageViewController: UIPageViewController, | |
viewControllerBefore viewController: UIViewController) -> UIViewController? { | |
guard let viewControllerIndex = orderedViewControllers.index(of: viewController) else { | |
return nil | |
} | |
NewerOlder