View jscore.md

JavaScriptCore is a built-in iOS library that enables you to use JavaScript in apps alongside Objective-C and Swift. It lets developers read JavaScript from a string, execute it from Objective-C or Swift, and share data structures and functions across languages. We JavaScriptCore to share code between Web and iOS.

Sharing code helped us produce a high-quality, consistent experience across devices while iterating rapidly.

This post is about why we chose to use JavaScriptCore and what we learned. The biggest challenges to using JavaScriptCore in a production app were performance optimization for older devices and getting the build process right. Luckily, these problems have simple solutions that just weren't documented.

Why did we use JavaScriptCore?

A killer feature of one of our apps is search that is optimized for finding guests by name. Our goals included:

View exp.py
import os
import shutil
import yaml
#import json
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from sklearn.externals import joblib
View execute.js
#!/usr/bin/env node
function execute(command) {
const exec = require('child_process').exec
exec(command, (err, stdout, stderr) => {
process.stdout.write(stdout)
})
}
View BES Button
<div class="pageTitle">
<h2>Agriculture and Allied Sectors</h2>
<div class="btnArea"><a href="#" class="btn btn-primary"><i class="fa fa-angle-left" aria-hidden="true"></i> Back </a></div>
</div>
Button Changes Start for web
——————————————————
.pageTitle .btnArea .btn-primary { padding: 10px 15px !important; font-size: 16px; }
View app.rb
require 'sinatra'
require 'mongoid'
require 'json'
require "sinatra/reloader" if development?
Mongoid.load!("mongoid.yml")
class Price
include Mongoid::Document
View gist
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
View JS Algo - Reverse String - Reduce helper
function reverseString(string) {
return string.split('').reduce((reversed, character) => character + reversed, '');
}
View bash
export PATH=${PATH}:/Users/jxiong1/Dropbox/bin
alias bb='rsync -azPq --filter=":- .gitignore" --exclude=.git /Users/jxiong1/Documents /Users/jxiong1/Dropbox/Archives'
alias ee='docker run --rm -v $PWD:/scripts -v $PWD/config:/root/.config/earthengine eescript'
alias py='docker run --rm -p 443:443 -v /Users/jxiong1/Dropbox/py:/root/nb nbgallery/jupyter-alpine'
alias gc='git add . && git commit -m'
alias gl='git log --pretty=oneline | head'
alias rr='Rscript'
View gist:4dff9b6d007dbbbd4a26ee56d12b52bc
@font-face {
font-family: SegoeUI;
src:
local("Segoe UI Light"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2) format("woff2"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff) format("woff"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.ttf) format("truetype");
font-weight: 100;
}
View run_kafka_in_docker.sh
git clone https://github.com/wurstmeister/kafka-docker . && docker-compose up
docker run -it --rm -p 9000:9000 -e ZK_HOSTS="my.zookeeper.host.com:2181" -e APPLICATION_SECRET=letmein sheepkiller/kafka-manager