This documentation have an objective to demonstrate the git command line tool with some context and use cases.
See this Git Documentation website to understand more how git works or run git --help
to get some input.
// | |
// CollectionViewController.swift | |
// 3D Touch | |
// | |
// Created by Bruno Miguêns on 20/03/2017. | |
// Copyright © 2017 Bruno Miguêns. All rights reserved. | |
// | |
// MARK: Peek & Pop: Initialization |
This documentation have an objective to demonstrate the git command line tool with some context and use cases.
See this Git Documentation website to understand more how git works or run git --help
to get some input.
#!/usr/bin/env bash | |
BLUE=`tput setaf 4` | |
CYAN=`tput setaf 6` | |
NOCOLOR=`tput sgr0` | |
# Change '~/Documents' to whatever path/directory you want to fetch the pod files. | |
find ~/Documents -name 'Podfile' -type f -mtime -1 -print0 | xargs -0 | sort -nr | while read str; do | |
echo "" |
import JavaScriptCore | |
let context = JSContext() | |
context?.exceptionHandler = { context, exception in | |
print("JS Error: \(exception!)") // Do not use force unwrap `!` | |
} |
import JavaScriptCore | |
let context = JSContext() | |
context?.evaluateScript("var console = { log: function(message) { _consoleLog(message) } }") | |
let consoleLog: (String) -> Void = { message in | |
print("JS Log: \(message)") | |
} |
npm install -g browserify | |
npm install --save cson-parser | |
browserify ./cson-parser/cson-parser.js --standalone CSON > ./cson-parser-bundle.js |
import JavaScriptCore | |
func loadJSBundle(for context: JSContext?) { | |
guard let libraryPath = Bundle.main.path(forResource: "cson-parser-bundle", ofType: "js"), | |
let libraryCode = try? String(contentsOfFile: libraryPath) else { | |
return | |
} | |
context?.evaluateScript(libraryCode) |
let context = generateJSContext() | |
loadJSBundle(for: context) | |
if let csonPath = Bundle.main.path(forResource: "cson-sample", ofType: "cson"), let csonData = try? String(contentsOfFile: csonPath) { | |
context?.setObject(csonData, forKeyedSubscript: "parseStringData" as NSCopying & NSObjectProtocol) | |
let jsonData = context?.evaluateScript("CSON.parse(parseStringData)")?.toDictionary() | |
print(jsonData?.description ?? "") |
title: "Sample" | |
tags: ["One", "Two"] | |
message: ''' | |
This is a Sample Message | |
''' | |
isStarred: false |
import JavaScriptCore | |
func generateJSContext() -> JSContext? { | |
let context = JSContext() | |
context?.evaluateScript("var console = { log: function(message) { _consoleLog(message) } }") | |
let consoleLog: (String) -> Void = { message in | |
print("JS Log: \(message)") |