Skip to content

Instantly share code, notes, and snippets.

View rcerrejon's full-sized avatar

Rafael Cerrejon rcerrejon

View GitHub Profile
@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 / 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 / ModalView.swift
Created April 7, 2017 08:37
Dismiss Modal View
dismiss(animated: true, completion: nil)
let stringOriginal = "http://www.google.de/json?origin with space"
let stringUrlEnc = stringOriginal.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
@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)
// 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 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.
@rcerrejon
rcerrejon / responsiveVimeo.js
Created July 26, 2016 15:04
Responsive iFrame (video responsive)
if ($('.vimeo-iframe').length > 0) {
oWindowWidth = $(window).outerWidth();
oWindowHeight = $(window).outerHeight();
windowWidth = $(window).outerWidth() - 10;
windowHeight = $(window).outerHeight() - 128;
wCalc = ((windowWidth * 100)/1280);
hCalc = ((windowHeight * 100)/720);
rwCalc = 1280 * (hCalc/100);
rhCalc = 720 * (wCalc/100);
if (oWindowWidth < 1280) {
@rcerrejon
rcerrejon / db.php
Created June 15, 2016 13:51
Query Standard Way in Extbase
/** Connect to the Database by TYPO3_DB */
/** @var DatabaseConnection $db */
$db = $GLOBALS['TYPO3_DB'];
//Execute Query
$result = $db->exec_SELECTgetRows('SELECT * FROM tx_test_tabelle');
//Get Results
return $result;
@rcerrejon
rcerrejon / style.css
Last active June 13, 2016 14:25
Media Queries
/* Mobile */
@media only screen and (min-device-width : 375px) and (max-device-width : 667px) {
}
/* Tablet Portrait */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {
}
/* Tablet Landscape */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) {