Skip to content

Instantly share code, notes, and snippets.

View rcfrias's full-sized avatar

Roberto Frias rcfrias

View GitHub Profile
@rcfrias
rcfrias / xdebug7_install
Created January 23, 2018 18:57
Special instructions to setup Xdebug in Amazon Linux with PHP7
sudo yum -y install php7-pear php70-devel gcc
sudo pecl7 install xdebug
vi /etc/php-7.0.ini
*add "zend_extension=/usr/lib64/php/7.0/modules/xdebug.so" to php.ini
apachectl restart
@rcfrias
rcfrias / flatNestedArray.swift
Last active August 10, 2017 16:23
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
//: Playground - noun: a place where people can play
import Foundation
// [[1,2,[3]],4] -> [1,2,3,4].
var myArray = [[1,2,[3]],4] as [Any]
func flatNestedArray(_ array: [Any]) -> [Int]{
@rcfrias
rcfrias / 0_reuse_code.js
Created June 30, 2017 15:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rcfrias
rcfrias / gist:99b00dcfdeef41d90b23
Last active August 29, 2015 14:08
How to import libraries with cocoa pods and fix the "Apple Mach-O Linker error, Undefined symbols for architecture"
All you have to do is run the "pod install" on terminal go to the main project build settings, search for "Other linker flags" and replace the old "-ObjC -all_load" with the following:
$(inherited)
*IMPORTANT NOTE!!! For some strange reason, you need to be using Ruby 2.0.0. just download it and run following command:
rvm use ruby-2.0.0-p576
1, 2, 3, Bamm! like magic ;)
@rcfrias
rcfrias / gist:aaca74180428ab9b0b4b
Created October 7, 2014 20:12
Getting the Top-most View Controller on an iOS Application
UIViewController *topViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
while (topViewController.presentedViewController) {
topViewController = topViewController.presentedViewController;
}
@rcfrias
rcfrias / gist:bf861cd9517e869ce912
Last active August 29, 2015 14:07
Script to fix Charles Proxy in order to monitor Xcode 6 Simulator calls. Download the script from http://www.charlesproxy.com/documentation/faqs/ssl-connections-from-within-iphone-applications/ and replace the content with following code. After saving, run it with Terminal.
#/bin/bash
install() {
if [ -f "$SQLITEDBPATH" ]; then
cp -n "$SQLITEDBPATH" "$SQLITEDBPATH.charlesbackup"
sqlite3 "$SQLITEDBPATH" <<EOF
INSERT INTO "tsettings" VALUES(X'189B6E28D1635F3A8325E1E002180DBA2C02C241',X'3123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E6731243022060355040B0C1B687474703A2F2F636861726C657370726F78792E636F6D2F73736C3111300F060355040A0C08584B3732204C74643111300F06035504070C084175636B6C616E643111300F06035504080C084175636B6C616E64310B3009060355040613024E5A',X'3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E0A3C21444F435459504520706C697374205055424C494320222D2F2F4170706C652F2F44544420504C49535420312E302F2F454E222022687474703A2F2F7777772E6170706C652E636F6D2F445444732F50726F70657274794C6973742D312E302E647464223E0A3C706C6973742076657273696F6E3D22312E30223E0A3C61727261792F3E0A3C2F706C6973743E0A',X'3082045E30820346A003020102020101300D06092A864886F70D01010505003081913123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E67312430
@rcfrias
rcfrias / gist:d0da0b5d44191c65101e
Last active August 29, 2015 14:07
Setup to effectively set Transparent background on a UITableView inside another ViewController in iOS 7 and iOS 8. Included mods for default textfield font, color and size.
// "ViewController.h"
@property (strong, nonatomic) IBOutlet UITableView *tableView;
// "ViewController.m"
// Asuming the current ViewController is a delegate for the UITableView.
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
@rcfrias
rcfrias / gist:d7d89bef60769bc9bc5d
Created September 27, 2014 21:08
Transfer files and/or folders between 2 remote linux servers using sftp and ssh
* Assuming we have 2 remote linux servers running Ubuntu A and B. Using a Mac and Terminal to run the commands.
1. Connect to one remote server from your computer ( A )
a) Open Terminal and access the remote server using ssh.
Example: ssh -l user server (name or ip)
2. Make the remote server A connect to B using sftp:
Example: sftp username@remote_hostname_or_IP
3. Use the command pwd to print the current REMOTE working directory (Server B).
@rcfrias
rcfrias / ViewController.m
Created September 25, 2014 04:32
UIViewController TextFields hidden by keyboard. Using this setup, we solve this basic UI issue without the need of UIScrollView. Supports iOS8 new QuickType feature. The example assumes, the ViewController.h header implements UITextFieldDelegate
//
// ViewController.m
//
// Created by Roberto Frias on 22/08/14.
// Copyright (c) 2014 gmri. All rights reserved.
//
#import "ViewController.h"
@implementation ViewController{
@rcfrias
rcfrias / siteinfo.php
Created September 25, 2014 03:49
Simple PHP test file and configuration data.
<?php
phpinfo();