Instantly share code, notes, and snippets.

# Tokuriku

• Sort options
Last active Aug 29, 2015
Clamp Velocity of an SKNode's PhysicsBody
View Clamp Velocity of an SKNode's PhysicsBody
 /* Clamp Velocity */ // Set the initial parameters let maxVelocity = CGFloat(100) let deltaX = (self.physicsBody?.velocity.dx)! let deltaY = (self.physicsBody?.velocity.dy)! // Get the actual length of the vector with Pythagorean Theorem let deltaZ = sqrt(pow(deltaX, 2) + pow(deltaY, 2))
Last active Dec 3, 2019 — forked from ccabanero/Count lines of code in Xcode project
Count lines of code in SWIFT Xcode project
View Count lines of code in Xcode project
 1. Open Terminal 2. cd to your Xcode project 3. Execute the following when inside your target project: find . -name "*.swift" -print0 | xargs -0 wc -l
Last active Jan 8, 2020
Useful emoji for git commit messages
View git-commit-emojis.md

# Useful emoji for git commit messages

If you add emoji to your commit messages for a GitHub repo, they become less boring, and you can convey the kind of change you're adding. See the full set of GitHub supported emoji here (also useful for easy copy&paste via a simple click).

The following is a possible scheme to use:

Last active Aug 29, 2015
Remapping a CGPoint for use with SKPhysicsJoints in a non CGPointZero anchorPoint Scene
View Remap Point
 //To be applied to the anchor point func remapPoint(point: CGPoint) -> CGPoint { let correctedX = point.x + self.size.width * self.anchorPoint.x let correctedY = point.y + self.size.height * self.anchorPoint.y return CGPoint(x: correctedX, y: correctedY) }
Last active Sep 26, 2018
Basic code to get the Hardware Model of an iOS device in Swift
View iOS Hardware Scanner
 func platform() -> String { var size: UInt = 0 sysctlbyname("hw.machine", nil, &size, nil, 0) var machine = [CChar](count: Int(size), repeatedValue: 0) sysctlbyname("hw.machine", &machine, &size, nil, 0) return String.fromCString(machine)! } func model() -> String { let model = self.platform()
Last active Jan 15, 2020 — forked from cromandini/universal-framework.sh
Script to put in an Aggregate Target of a Framework in Xcode 6 to create a Universal Framework
View universal-framework.sh
 #!/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
Last active Jan 23, 2020 — forked from cconway25/gist:7ff167c6f98da33c5352
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).
View universal-framework.sh
 #!/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
Created Aug 9, 2014
Count lines of code in Xcode project
View Count lines of code in Xcode project
 1. Open Terminal 2. cd to your Xcode project 3. Execute the following when inside your target project: find . -name "*.[hm]" -print0 | xargs -0 wc -l
Last active Jun 20, 2019
Script for iOS Universal Framework compilation with Xcode 6
View gist:f4b1504aec9d25f5af08
 # This script is based on Jacob Van Order's answer on apple dev forums https://devforums.apple.com/message/971277 # See also http://spin.atomicobject.com/2011/12/13/building-a-universal-framework-for-ios/ for the start # To get this to work with a Xcode 6 Cocoa Touch Framework, create Framework # Then create a new Aggregate Target. Throw this script into a Build Script Phrase on the Aggregate ###################### # Options
Last active Jan 11, 2020
osx + java 7 = painfully easy
View index.md

## Step 1

Does your osx terminal speak java 7? Start `Terminal.app` and try: `java -version`:

```> java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)```
You can’t perform that action at this time.