Skip to content

Instantly share code, notes, and snippets.

View galileoguzman's full-sized avatar
🤓
Making the world programmable

Galileo Guzmán galileoguzman

🤓
Making the world programmable
View GitHub Profile
@galileoguzman
galileoguzman / hidden_files.sh
Created September 7, 2015 18:58
How to show and hide files in OSX
defaults write com.apple.finder AppleShowAllFiles TRUE
KillAll Finder
# import ViewControllerNameWindow.h in the file .h (header)
# add property in the controller
@property (nonatomic, strong) ModalController *modal;
# Create method for lauch the modal view in the current content view controller .m
- (IBAction)btnShowModal:(id)sender {
//Show wifi settings to customer
@galileoguzman
galileoguzman / jquery.ajax.js
Created September 28, 2015 16:28
Example how to use AJAX function on JQUERY
$.ajax({
type : 'POST',
url : 'http://localhost/api/get/all',
data : {'token': 'some string'},
dataType: 'JSON',
cache : false,
beforeSend : function(){
//Before to send request do a animation
// ...
},
@galileoguzman
galileoguzman / random_string_with_digits.py
Created October 27, 2015 17:10
Generate random string with digits
# function definition
def generate_public_key(self):
#import libs
import string
import random
# make magic
k = ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(255)])
#return the value
@galileoguzman
galileoguzman / unix_timestamp_python.py
Created October 28, 2015 19:02
How to convert unix timestamp to datetime python class
## IMPORT THE DATETIME MODULE
import datetime
## CONVERT THE RAW STRING WITH STRFTIME METHOD
print(
datetime.datetime.fromtimestamp(
int("1284101485")
).strftime('%Y-%m-%d %H:%M:%S')
@galileoguzman
galileoguzman / django_ami.md
Created November 18, 2015 03:31 — forked from aderowbotham/django_ami.md
Django stack setup on EC2 AMI

Django Stack

Overview

This is a set of instructions to setup a Django Nginx Gunicorn MySQL/Postgres stack on a single Amazon EC2 instance.

Server - AWS

@galileoguzman
galileoguzman / tutorial cocoa pods.MD
Last active January 27, 2016 19:25
Tutorial Cocoapods

How to use Cocoapods with ObjC

This file will help you to init project with Xcode and Objective C with pagage manager Cocoapods. The head first are make sure that we have installed Cocoapods on our system.

IMPORTANT: Make sure you have ruby cli installed on your system.

sudo gem install cocoapods

After have installed cocoapods, you have to export the environment vars for your system can to recognize cocoapods cli.

@galileoguzman
galileoguzman / NSURLSession.MD
Created February 5, 2016 00:58
How to make common method to call api

#How to use NSURLSession

http://stackoverflow.com/questions/24851772/how-to-return-nsdata-from-nsurlsessiondatatask-completion-handler

+ (NSURLSessionDataTask *)postCall:(NSDictionary *)parameters fromURL:(NSString *)url completionHandler:(void (^)(NSData *data, NSURLResponse *response, NSError *error))completionHandler {

    // create your request here ...

    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {

if (completionHandler)

@galileoguzman
galileoguzman / format_uiTextFieldCalculator.md
Last active March 29, 2016 06:50
Trying to format a UITextField to behave like a currency calculator for only numeric input in iOS

e.g. when entering the number "1234.56".

  1. $ 0.00.

  2. $ 0.01.

  3. $ 0.12.

  4. $ 1.23.

@galileoguzman
galileoguzman / floatingButton.html
Created January 27, 2017 06:06
Floating button for any call to action.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Floating Button!</title>
<style type="text/css">
*{
border: 0;