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.
import UIKit | |
import JavaScriptCore | |
import PlaygroundSupport | |
func generateContextJS() -> JSContext? { | |
let context = JSContext() | |
context?.evaluateScript("var console = { log: function(message) { _consoleLog(message) } }") | |
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)") |
title: "Sample" | |
tags: ["One", "Two"] | |
message: ''' | |
This is a Sample Message | |
''' | |
isStarred: false |
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 ?? "") |
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) |
npm install -g browserify | |
npm install --save cson-parser | |
browserify ./cson-parser/cson-parser.js --standalone CSON > ./cson-parser-bundle.js |
import JavaScriptCore | |
let context = JSContext() | |
context?.evaluateScript("var console = { log: function(message) { _consoleLog(message) } }") | |
let consoleLog: (String) -> Void = { message in | |
print("JS Log: \(message)") | |
} |
import JavaScriptCore | |
let context = JSContext() | |
context?.exceptionHandler = { context, exception in | |
print("JS Error: \(exception!)") // Do not use force unwrap `!` | |
} |
#!/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 "" |
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.