Skip to content

Instantly share code, notes, and snippets.

View erikfloresq's full-sized avatar
Open your eyes

Erik Flores erikfloresq

Open your eyes
View GitHub Profile
@erikfloresq
erikfloresq / safariViewController.swift
Created March 4, 2016 22:16
show safariViewController
class func showSafariWebWith(urlString:String,inView view:UIViewController){
let url = NSURL(string: urlString as String)
if #available(iOS 9.0, *) {
//let safariVC = SFSafariViewController(URL: url!)
let safariVC = SFSafariViewController(URL: url!, entersReaderIfAvailable: true)
safariVC.view.tintColor = UIColor(red: 189/255.0, green: 151/255.0, blue: 8/255, alpha: 1)
view.presentViewController(safariVC, animated: true, completion: nil)
@erikfloresq
erikfloresq / animateCell.swift
Created March 4, 2016 22:15
Presentation cell with animation
class func animateCell(cell:UITableViewCell) -> Void{
let fadeOutAnimation:CABasicAnimation = CABasicAnimation(keyPath: "opacity")
fadeOutAnimation.duration = 1.0
fadeOutAnimation.removedOnCompletion = false
fadeOutAnimation.fillMode = kCAFillModeBackwards
fadeOutAnimation.fromValue = NSNumber(float: 0.0)
fadeOutAnimation.toValue = NSNumber(float: 1.0)
cell.layer.addAnimation(fadeOutAnimation, forKey: "animateOpacity")
class func getFormatterDate(dateString:String?)->String{
let dateFormater = NSDateFormatter()
dateFormater.dateFormat = "yyyy-MM-dd'T'HH:mm:ss"
//dateFormater.dateFormat = "dd MMMM yyyy"
dateFormater.timeZone = NSTimeZone(abbreviation: "GMT-05:00")
dateFormater.timeZone = NSTimeZone(name: "America/Lima")
let locale:NSLocale = NSLocale(localeIdentifier: "en_US_POSIX")
dateFormater.locale = locale
@erikfloresq
erikfloresq / toolbar.swift
Created March 4, 2016 22:13
Add toolbar in keyboard
class func setUpToolBar(txtField:UITextField, vista:UIViewController){
let btn1:UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FlexibleSpace, target: nil, action: nil)
let btn2:UIBarButtonItem = UIBarButtonItem(title: "Listo", style: UIBarButtonItemStyle.Done, target: nil, action: "hideKeyboard")
btn2.tintColor = UIColor.blackColor()
let items:NSArray = [btn1,btn2]
let toolBar: UIToolbar = UIToolbar(frame: CGRectMake(0,0,vista.view.frame.size.width,40))
toolBar.barStyle = UIBarStyle.Default
toolBar.barTintColor = UIColor.lightTextColor()
@erikfloresq
erikfloresq / keyboard.swift
Last active March 8, 2016 04:23
Show keyboard with scrollview
// properti
var tapper:UIGestureRecognizer!
// hide keyboard with tap
self.tapper = UITapGestureRecognizer(target: self, action: "handleSingleTapToHideKeyboard:")
self.view.addGestureRecognizer(self.tapper)
func handleSingleTapToHideKeyboard(sender:UITapGestureRecognizer) {
self.view.endEditing(true)
}
@erikfloresq
erikfloresq / buttonWithCode.m
Last active March 4, 2016 22:03
Create button with code
UIButton *btnStreetView = [UIButton buttonWithType:UIButtonTypeCustom];
btnStreetView.frame = CGRectMake( _viewMapa.frame.size.width - 130 , _viewMapa.frame.size.height - 40, 120, 30);
[btnStreetView setTitle:@"Ver StreetView" forState:UIControlStateNormal];
btnStreetView.titleLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0f];
btnStreetView.layer.cornerRadius = 3;
[btnStreetView addTarget:self action:@selector(changeTypeMap) forControlEvents:UIControlEventTouchUpInside];
btnStreetView.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
btnStreetView.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[btnStreetView setTitleColor:[UIColor colorWithRed:0.988 green:0.988 blue:0.988 alpha:1] forState:UIControlStateNormal];
btnStreetView.backgroundColor = [UIColor colorWithRed:0.980 green:0.412 blue:0.012 alpha:1];
@erikfloresq
erikfloresq / httpd-vhost.conf
Created July 13, 2015 17:10
vhost yosemite
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
@erikfloresq
erikfloresq / httpd.conf
Last active November 26, 2015 15:04
httpd yosemite
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@erikfloresq
erikfloresq / gulpfile.js
Created August 16, 2014 16:58
Gulp File básico para arrancar proyecto con stylus jade y coffee
var gulp = require('gulp');
var coffee = require('gulp-coffee');
var jade = require('gulp-jade');
var stylus = require('gulp-stylus');
var jeet = require('jeet');
var rupture = require('rupture');
var gutil = require('gulp-util');
var paths ={
@erikfloresq
erikfloresq / showCounter
Created February 17, 2014 16:04
Mostrar los numeros como contador que aumenta automaticamte
$(document).ready(function(){
var num = 0;
var interval = setInterval(function(){
$('#numbers').text(num);
num++;
if(num === 100){
clearInterval(interval);
};
},10);
});