Skip to content

Instantly share code, notes, and snippets.

let pathAnimation = CABasicAnimation(keyPath: "strokeEnd");
pathAnimation.duration = 10
pathAnimation.fromValue = NSNumber(float: 0)
pathAnimation.toValue = NSNumber(float: 1)
pathLayer?.addAnimation(pathAnimation, forKey: "strokeEnd")
let penAnimation = CAKeyframeAnimation(keyPath: "position")
penAnimation.duration = 10
penAnimation.path = pathLayer?.path
penAnimation.calculationMode = kCAAnimationPaced
//
// Signal+Extensions.swift
// Khan Academy
//
// Created by Nacho Soto on 10/1/15.
// Copyright © 2015 Khan Academy. All rights reserved.
//
import ReactiveCocoa
@IamAlchemist
IamAlchemist / RAC.swift
Last active March 21, 2016 09:11
RAC.swift
//
// RAC.swift
// MapleStory
//
// Created by Wizard Li on 3/21/16.
// Copyright © 2016 tencent. All rights reserved.
//
// Original source can be found at:
// https://github.com/ColinEberhardt/ReactiveTwitterSearch/blob/master/ReactiveTwitterSearch/Util/UIKitExtensions.swift
//
//
// ViewController.swift
// test
//
// Created by Wizard Li on 5/26/16.
// Copyright © 2016 cc.kauhaus. All rights reserved.
//
import UIKit
@IamAlchemist
IamAlchemist / universal-framework.sh
Created August 17, 2016 08:29 — forked from cromandini/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@IamAlchemist
IamAlchemist / uninstall-node.sh
Last active October 10, 2016 03:08 — forked from nicerobot/README.md
Mac OS X uninstall script for packaged install of node.js
#!/bin/sh
(( ${#} > 0 )) || {
echo 'DISCLAIMER: USE THIS SCRIPT AT YOUR OWN RISK!'
echo 'THE AUTHOR TAKES NO RESPONSIBILITY FOR THE RESULTS OF THIS SCRIPT.'
echo "Disclaimer aside, this worked for the author, for what that's worth."
echo 'Press Control-C to quit now.'
read
echo 'Re-running the script with sudo.'
echo 'You may be prompted for a password.'
sudo ${0} sudo
@IamAlchemist
IamAlchemist / datepicker.swift
Created October 10, 2016 03:07
a date picker in alert view
@IBAction func selectDate(_ sender: UIButton) {
let datePicker = UIDatePicker()
datePicker.datePickerMode = .date
let alert = UIAlertController(title: "\n\n\n\n\n\n\n\n\n\n\n", message: nil, preferredStyle: .actionSheet)
alert.view.addSubview(datePicker)
datePicker.snp.makeConstraints { (make) in
make.centerX.equalTo(alert.view)
make.top.equalTo(alert.view).offset(8)
@IamAlchemist
IamAlchemist / nitialize_Swift_subclass_of_UIView.swift
Last active October 11, 2016 09:55 — forked from bwhiteley/gist:049e4bede49e71a6d2e2
Initialize Swift subclass of UIView, designed in .xib
// Create CustomView.xib, set File's Owner to CustomView.
// Link the top level view in the XIB to the contentView outlet.
class CustomView : UIView {
@IBOutlet private var contentView:UIView?
// other outlets
override init(frame: CGRect) { // for using CustomView in code
super.init(frame: frame)
self.commonInit()
#!/bin/sh
XBUILD="/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild"
SHELL_PATH=$(dirname $(pwd -P $0)/${0#\.\/})
PROJECT_ROOT="$SHELL_PATH/../Comic"
PROJECT="$PROJECT_ROOT/Comic.xcodeproj"
TARGET="comic"
KEEP_INCLUDE_DIR=""
ARCH="Release"
@IamAlchemist
IamAlchemist / objective_c_macro.m
Created March 28, 2017 05:42
macro objective-c
#define __wvjb_js_func__(x) #x
static NSString * preprocessorJSCode = @__wvjb_js_func__(
a();
b();
);
#undef __wvjb_js_func__