Skip to content

Instantly share code, notes, and snippets.

View ryangittings's full-sized avatar

ryangittings

View GitHub Profile
struct DiscoverView : View {
var body: some View {
NavigationView {
List {
ScrollView(.horizontal) {
HStack(spacing: 8) {
ForEach(1...10, id: \.self) { index in
NavigationLink(destination: ContentView()) {
Image(systemName: "tv.fill")
.resizable()
struct ContentView: View {
var body: some View {
List {
PosterView()
Section(header: Text("Section")) {
TestView()
}
Section(header: Text("Section")) {
@ryangittings
ryangittings / PerchTemplateFilter_Length
Created May 13, 2019 10:24
Perch template filter for getting a Perch item's reading length in minutes
<?php
class PerchTemplateFilter_length extends PerchTemplateFilter
{
public function filterBeforeProcessing($value, $valueIsMarkup = false)
{
$word = str_word_count(strip_tags($value));
$m = floor($word / 200);
$s = floor($word % 200 / (200 / 60));
var scrollElement = function (element, scrollPosition, duration) {
var style = element.style;
// setup CSS transition duration and easing function
style.webkitTransition =
style.transition = duration + 's';
style.webkitTransitionTimingFunction =
style.TransitionTimingFunction = 'ease-in-out';
// use translate3d to force hardware acceleration