Skip to content

Instantly share code, notes, and snippets.

View rcerrejon's full-sized avatar

Rafael Cerrejon rcerrejon

View GitHub Profile
@rcerrejon
rcerrejon / ViewController.swift
Created April 5, 2017 15:27
Admob loader (with test)
import UIKit
import GoogleMobileAds
class ViewController: UIViewController {
@IBOutlet weak var bannerView: GADBannerView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Between import and class
struct Constants {
static var stringVar = "foo"
static var intVar = 34
}
// Call it like:
Constants.stringVar = "bar"
@rcerrejon
rcerrejon / ViewController.swift
Created April 7, 2017 08:33
Alert View with Ok Button
let alert = UIAlertController(title: "Error", message: "Please, fill the Form", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default))
self.present(alert, animated: true, completion: nil)
let stringOriginal = "http://www.google.de/json?origin with space"
let stringUrlEnc = stringOriginal.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
@rcerrejon
rcerrejon / ModalView.swift
Created April 7, 2017 08:37
Dismiss Modal View
dismiss(animated: true, completion: nil)
@rcerrejon
rcerrejon / UserSettings.swift
Created April 7, 2017 08:39
UserSettings in Swift 3
// inside the Class outside function
let userSettings = UserDefaults.standard
// Setter
userSettings.set("foo", forKey: "foobar")
// Getter
let foo = userSettings.string(forKey: "foobar")
@rcerrejon
rcerrejon / alertbox.jsx
Created May 10, 2017 09:30
Simple alertbox
import { Alert } from 'react-native';
Alert.alert(
'Route',
'clicked!',
[{ text: 'OK', onPress: () => console.log('OK Pressed') }],
{ cancelable: false }
);
@rcerrejon
rcerrejon / npm
Last active May 30, 2017 14:09
Clean and restart full dependencies node_modules etc...
watchman watch-del-all && yarn upgrade && yarn cache clean && npm start --reset-cache
@rcerrejon
rcerrejon / atom_packages
Last active May 23, 2017 13:04
Atom full package set to develop in React/React Native
apm install atom-beautify autoclose-html highlight-selected language-babel linter linter-eslint minimap minimap-highlight-selected pigments seti-ui monokai-seti
Atom-beautify: Ctrl+Alt+B
Minimap: Absolute Mode: True
Seti UI: Compact Mode: True
@rcerrejon
rcerrejon / appstore.jsx
Created June 27, 2017 14:40
Link to Appstore/GooglePlay
let urlStore = 'iTunes Link';
if (Platform.OS === 'android') {
urlStore = 'Google Play Link';
}
Alert.alert(
'Appstore / Google Play',
'Linking to Store',
[{
text: 'OK',
onPress: () => Linking