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
// Make sure to include font files in bundle | |
// Add "Fonts provided by application" / UIAppFonts to Info.plist (use filename) | |
// Run this snippet in AppDelegate to find the name of your fonts | |
UIFont.familyNames.forEach { family in | |
print(family) | |
UIFont.fontNames(forFamilyName: family).forEach { names in | |
print(" - ", names) | |
} | |
} |
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
class FairPlayer: AVPlayer { | |
private let queue = DispatchQueue(label: "com.icapps.fairplay.queue") | |
func play(asset: AVURLAsset) { | |
// Set the resource loader delegate to this class. The `resourceLoader`'s delegate will be | |
// triggered when FairPlay handling is required. | |
asset.resourceLoader.setDelegate(self, queue: queue) | |
// Load the asset in the player. |
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 React from 'react'; | |
const hasDataForKey = (staticContext) => (key) => staticContext && Object.keys(staticContext.data).includes(key); | |
const windowHasDataForKey = (window) => (key) => Object.keys(window.__DATA__).includes(key); | |
export default ({ key, prop, getData }) => (WrappedComponent) => { | |
class SSRCompatibleComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {}; |
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 React, { Component } from 'react'; | |
const hasDataForThisKey = (staticContext) => | |
(key) => staticContext && Object.keys(staticContext.data).includes(key); | |
const windowHasDataForThisKey = (window) => | |
(key) => Object.keys(window.__DATA__).includes(key); | |
export default ({ | |
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
extension URI { | |
public func appendingQueryParameters(_ parameters: [String: String]) -> URI { | |
let allParameters = mergeParameters(queryParameters(fromQuery: query), rhs: parameters) | |
let newQuery = toQuery(parameters: allParameters) | |
return URI(scheme: scheme, userInfo: userInfo, hostname: hostname, port: port, path: path, | |
query: newQuery, fragment: fragment) | |
} | |
private func toQuery(parameters: [String: String]) -> String { |
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 Foundation | |
import UIKit | |
extension UIView { | |
func addSubviews(_ subviews: [UIView]) { | |
for view in subviews { | |
addSubview(view) | |
} | |
} | |
} |
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
apt-get update | |
apt-get install -y build-essential curl | |
apt-get -y install git g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev libjemalloc-dev cython python3-dev python-setuptools | |
git clone https://github.com/tatsuhiro-t/nghttp2.git | |
cd nghttp2 | |
autoreconf -i | |
automake | |
autoconf | |
./configure | |
make |
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 Foundation | |
import Vapor | |
import FluentProvider | |
struct Paginator<T: Model> where T: JSONRepresentable { | |
let query: Query<T> | |
let request: Request | |
let perPage: Int | |
init(query: Query<T>, request: Request, perPage: Int = 25) { |
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
+ export DOKKU_DISTRO | |
++ . /etc/os-release | |
++ echo ubuntu | |
+ DOKKU_DISTRO=ubuntu | |
+ export DOKKU_IMAGE=gliderlabs/herokuish | |
+ DOKKU_IMAGE=gliderlabs/herokuish | |
+ export DOKKU_LIB_ROOT=/var/lib/dokku | |
+ DOKKU_LIB_ROOT=/var/lib/dokku | |
+ export PLUGIN_PATH=/var/lib/dokku/plugins | |
+ PLUGIN_PATH=/var/lib/dokku/plugins |
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
root@speakerdex:~# dokku --trace redis:backup speakerdex-sessions speakerdex-redis-backups | |
+ export DOKKU_DISTRO | |
++ . /etc/os-release | |
++ echo ubuntu | |
+ DOKKU_DISTRO=ubuntu | |
+ export DOKKU_IMAGE=gliderlabs/herokuish | |
+ DOKKU_IMAGE=gliderlabs/herokuish | |
+ export DOKKU_LIB_ROOT=/var/lib/dokku | |
+ DOKKU_LIB_ROOT=/var/lib/dokku | |
+ export PLUGIN_PATH=/var/lib/dokku/plugins |