Skip to content

Instantly share code, notes, and snippets.

View jplazcano87's full-sized avatar
💭
Learning

Juan Pablo Lazcano jplazcano87

💭
Learning
  • Santiago, Chile
View GitHub Profile
@jplazcano87
jplazcano87 / gist:70fe49c9102481c96091
Created November 1, 2015 22:25 — forked from edwardmp/gist:a0ffb3ace02ce4392b26
Working example of accepting self-signed SSL certificate in Swift
import UIKit
import Foundation
class ViewController: UIViewController, NSURLSessionDelegate {
override func viewDidLoad() {
super.viewDidLoad()
httpGet(NSMutableURLRequest(URL: NSURL(string: "https://example.com")!))
}
@jplazcano87
jplazcano87 / publishAmazonSnsMsg.py
Created November 5, 2015 18:55 — forked from kylefritz/publishAmazonSnsMsg.py
publish a message to Amazon SNS using python or ruby
from time import strftime,gmtime,time
import urllib2
import hmac
import hashlib
import base64
import string
def publishAmazonSnsMsg(Subject,TopicArn,Message,AWSAccessKeyId,privatekey):
#http://docs.amazonwebservices.com/AWSSimpleQueueService/2008-01-01/SQSDeveloperGuide/
amzsnshost = 'sns.us-east-1.amazonaws.com'
@jplazcano87
jplazcano87 / sns-publish.py
Created November 6, 2015 16:27
Create, Publish and Subscribe Users to AWS SNS topics
import boto.sns
import logging
logging.basicConfig(filename="sns-publish.log", level=logging.DEBUG)
c = boto.sns.connect_to_region("us-east-1")
topicarn = "$TOPIC_ARN"
message = "hello Mr"
message_subject = "trialBotoTRopic"
@jplazcano87
jplazcano87 / SNSTopic.py
Created November 6, 2015 20:10 — forked from stuartmyles/SNSTopic.py
A complete example of how to use Amazon Web Services Simple Notification Services from Python. This code uses the boto library https://github.com/boto/boto to create a topic, wait for a confirmation and then send a success message. Simply plug in your AWS access and secret keys, plus your email and mobile phone number.
# An example of how to use AWS SNS with Python's boto
# By Stuart Myles @smyles
# http://aws.amazon.com/sns/
# https://github.com/boto/boto
#
# Inspired by parts of the Ruby SWF SNS tutorial http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-sns-tutorial-implementing-activities-poller.html
# And the Python SNS code in http://blog.coredumped.org/2010/04/amazon-announces-simple-notification.html and http://awsadvent.tumblr.com/post/37531769345/simple-notification-service-sns
import boto.sns as sns
import json
@jplazcano87
jplazcano87 / iOSCreatePDF.swift
Created December 14, 2015 15:16 — forked from nyg/iOSCreatePDF.swift
iOS, Swift: Create a PDF file from an HTML string
// Thanks to http://www.labs.saachitech.com/2012/10/23/pdf-generation-using-uiprintpagerenderer
import UIKit
// 1. Create a print formatter
let html = "<b>Hello <i>World!</i></b>"
let fmt = UIMarkupTextPrintFormatter(markupText: html)
// 2. Assign print formatter to UIPrintPageRenderer
import UIKit
import XCPlayground
class ViewController: UIViewController {
func action() { print("Bing!") }
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .whiteColor()
@jplazcano87
jplazcano87 / gist:db55f8bc41ee7f50d229663f4dc0b5a0
Created August 25, 2016 15:00 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@jplazcano87
jplazcano87 / AppHelper.java
Created September 5, 2016 14:29 — forked from anggadarkprince/AppHelper.java
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
@jplazcano87
jplazcano87 / EmptyRecyclerView.java
Created September 13, 2016 19:29 — forked from meoyawn/EmptyRecyclerView.java
RecyclerView doesn't have an emptyView support, we gotta fix that
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class EmptyRecyclerView extends RecyclerView {
@Nullable View emptyView;
@jplazcano87
jplazcano87 / AsyncTaskTests.java
Created October 23, 2016 15:44 — forked from he9lin/AsyncTaskTests.java
How to test AsyncTask in Android
package jieqoo.android.KASS.test.tasks;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import jieqoo.android.models.RESTListener;
import jieqoo.android.models.RESTResponse;
import jieqoo.android.tasks.FetchRESTResponseTask;
import jieqoo.android.util.Configuration;
import android.test.InstrumentationTestCase;