Skip to content

Instantly share code, notes, and snippets.

View matteocollina's full-sized avatar

Matteo Collina matteocollina

  • DMA
  • Cesena (FC) - Italy
View GitHub Profile
@matteocollina
matteocollina / ReactViewController.swift
Created March 29, 2018 21:18
Minimal ViewController that shows a react component
import Foundation
import React
class ViewController: UIViewController {
var reactRootView: RCTRootView!
var jsCodeLocation: URL!
override func viewDidLoad() {
super.viewDidLoad()
@matteocollina
matteocollina / index.ios.js
Last active March 29, 2018 21:36
Minimal react-native js file
'use strict';
import React from 'react';
import ReactNative, {
AppRegistry,
StyleSheet,
Text,
View,
} from 'react-native';
const styles = StyleSheet.create({
container: {
@matteocollina
matteocollina / info.plist
Created March 29, 2018 21:38
To enable Transport Security on Xcode project (HTTP requests)
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
@matteocollina
matteocollina / Podfile
Created March 29, 2018 21:40
Podfile to install react dependencies
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'StoryReact' do
use_frameworks!
pod 'React', :path => './js/node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTNetwork',
@matteocollina
matteocollina / package.json
Created March 29, 2018 21:41
Simple React Native package.json
{
"name": "StoryReact",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
}
}
@matteocollina
matteocollina / exp-jsbundle.sh
Last active April 4, 2018 14:05
This is the script to export the .jsbundle and import to Main Bundle of the app. It's necessary when you want to deploy an iOS with integrated React Native app on AppStore/TestFlight
# If on Release, must export js bundle to run
if [ "$CONFIGURATION" == "Debug" ]; then
echo "Debug Configuration"
else
echo "Release Configuration"
# in my project "js/node_modules"
cd js
# Create a new .jsbundle
react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output main.jsbundle
@matteocollina
matteocollina / make_app_simulator.sh
Created April 26, 2018 12:05
Make .app file for simulator
# Replace "MyApp" with your app name
XCODE_WORKSPACE=/Users/MacBook/iOS/MyApp.xcworkspace
xcrun xcodebuild \
-scheme MyApp \
-workspace $XCODE_WORKSPACE \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 8,OS=11.2' \
-derivedDataPath \
build
@matteocollina
matteocollina / Fastfile
Last active April 27, 2018 16:44
An example to create ad-hoc ipa and deploy to Crashlytics
platform :ios do
desc "Example Fastlane - Ipa + Crashlytics"
lane :beta do
get_provisioning_profile(
adhoc: true,
force: true
)
gym(
export_method:"ad-hoc",
scheme: "MyApp",
# react-native-cli: 2.0.1
# react-native: 0.55.3
# NB: My rn files are inside "js" dir
project 'Golee.xcodeproj'
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
@matteocollina
matteocollina / mongoutils.sh
Last active June 12, 2018 21:08
Lesson on Mongo db @ University (Milan). From install packages on python, to test Pymongo on macOSX
# ------ Prerequisites ------
# Start server
$ mongod
# Start client
$ mongo
# Install packages on python 2.7 (required version of "pip" >= 10)
$ sudo pip install --ignore-installed pymongo
$ sudo pip install --ignore-installed numpy