Skip to content

Instantly share code, notes, and snippets.

View resand's full-sized avatar

René Sandoval resand

View GitHub Profile
@resand
resand / aes.swift
Created June 20, 2018 04:36 — forked from ochim/aes.swift
[swift4]AES暗号化、復号化
// [CryptoSwift] https://github.com/krzyzanowskim/CryptoSwift
//
// Xcode 9.4
// Swift 4.1
import Foundation
import CryptoSwift
struct EncryptionUtil {
// MARK: - Coordinator keys
enum AppChildCoordinator {
case registration
case dashboard
}
class AppCoordinator: Coordinator {
// MARK: - Properties
@resand
resand / ios-how-to-communicate-with-iframes.md
Last active December 21, 2017 22:32 — forked from wayne5540/ios-how-to-communicate-with-iframes.md
This article is to show how to inject JavaScript into iframs under iOS web view and so we can communicate with it.

[iOS - Swift] How to communicate with iFrames inside WebView

To provide better shopping experience for Onefill users, we want to support as many shopping site as we can by injecting our JavaScript engine into those sites. However, some of them are using iframe which is outdated HTML tag to implement some forms like payment and signup. And due to security issue JavaScript can’t communicate with iframe unless it’s same domain or it’s your domain. So here is the approach we did to support iframe under iOS web view and so we can communicate with it.

  • Xcode: Version 8.2.1 (8C1002)
  • Swift: Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)

Conclusion first

@resand
resand / rest-server.py
Created August 16, 2017 21:42 — forked from miguelgrinberg/rest-server.py
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
@resand
resand / .gitignore
Created December 30, 2016 00:17 — forked from sendoa/.gitignore
Sendoa's .gitignore for Laravel+PHPStorm projects
/node_modules
/public/storage
/storage/*.key
/vendor
Homestead.yaml
Homestead.json
.env
# ====== OS X ===========================================
.DS_Store
@resand
resand / ioslocaleidentifiers.csv
Created November 25, 2016 23:02 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@resand
resand / Router.swift
Created October 17, 2016 17:44
Uploading a file with SWIFT via POST multipart/form-data (PHP)
import Foundation
import Alamofire
public enum Router:URLRequestConvertible {
public static let baseUrlString:String = "http://testapi.example.com"
case Upload(fieldName: String, fileName: String, mimeType: String, fileContents: NSData, boundaryConstant:String);
var method: Alamofire.Method {
switch self {
case Upload:
@resand
resand / FileUploader.swift
Created October 17, 2016 17:42 — forked from ncerezo/FileUploader.swift
Alamofire multipart upload
//
// FileUploader.swift
//
// Copyright (c) 2015 Narciso Cerezo Jiménez. All rights reserved.
// Largely based on this stackoverflow question: http://stackoverflow.com/questions/26121827/uploading-file-with-parameters-using-alamofire/28467829//
import Foundation
import Alamofire
private struct FileUploadInfo {
@resand
resand / UIViewController+Utils.swift
Created September 13, 2016 19:03 — forked from pablogm/UIViewController+Utils.swift
Swift UIViewController utils: custom status bar background color, popup alert message, ...
//
// UIViewController+StatusBar.swift
// Swift Extensions
//
import Foundation
import UIKit
/// Custom status bar background color on UIViewController
extension UIViewController {
@resand
resand / NSDate+Utils.swift
Created September 13, 2016 19:01 — forked from pablogm/NSDate+Utils.swift
Swift NSDate utils: Get date by adding / subtracting days from now, date at midnight, ...
//
// NSDate+Utils.swift
// Swift Extensions
//
import Foundation
import UIKit
extension NSDate {
class func dateByAddingDays(days: Int) -> NSDate {