Skip to content

Instantly share code, notes, and snippets.

View johnny77221's full-sized avatar

John Hsu johnny77221

View GitHub Profile
@quangDecember
quangDecember / build-binary-universal-framework.sh
Last active June 18, 2021 09:55
Build Binary framework script for iOS, included fix for Xcode 10.2 headers, originally by DJ110
# Xcode 10.2
# please use within Xcode environment (Build Phases -> Run Script or Scheme -> Post Actions)
xcodebuild -version
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
env > env.txt
# Step 1. Build Device and Simulator versions
xcodebuild -project "${PROJECT_NAME}.xcodeproj" -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@IanKeen
IanKeen / NSTimeInterval+Extension.swift
Last active October 16, 2019 04:32
Working Swiftly with NSTimeInterval
enum TimePeriod {
case Seconds(Int)
case Minutes(Int)
case Hours(Int)
var timeInterval: NSTimeInterval {
switch self {
case .Seconds(let value): return NSTimeInterval(value)
case .Minutes(let value): return NSTimeInterval(value * 60)
case .Hours(let value): return NSTimeInterval(value * 60 * 60)
@cferdinandi
cferdinandi / stop-video.js
Last active February 15, 2024 17:03
A simple method to stop YouTube, Vimeo, and HTML5 videos from playing.
/**
* Stop an iframe or HTML5 <video> from playing
* @param {Element} element The element that contains the video
*/
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;