$ uname -r
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MCryptAES { | |
private $iv; | |
private $key; | |
private $bit; //Only can use 128, 256 | |
public function __construct($key, $bit = 128, $iv = "") { | |
if($bit == 256){ | |
$this->key = hash('SHA256', $key, true); | |
}else{ | |
$this->key = hash('MD5', $key, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getQueryStringParameter(url: String, param: String) -> String? { | |
let url = NSURLComponents(string: url)! | |
return | |
(url.queryItems? as [NSURLQueryItem]) | |
.filter({ (item) in item.name == param }).first? | |
.value() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIBorderedLabel.swift | |
// standToMake | |
// | |
// Created by Karl Oscar Weber on 9/13/14. | |
// Copyright (c) 2014 Karl Oscar Weber. All rights reserved. | |
// | |
// Thanks to: http://userflex.wordpress.com/2012/04/05/uilabel-custom-insets/ | |
import UIKit |
Interface for dealing with gesture recognizers via native swift closure syntax
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.addSingleTapGestureRecognizerWithResponder { (tap) -> Void in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
var name = "" | |
var age = 0 | |
init(name: String, age:Int) { | |
self.name = name | |
self.age = age | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make sure you add #import <CommonCrypto/CommonCrypto.h> to the Xcode bridging header! | |
enum CryptoAlgorithm { | |
case MD5, SHA1, SHA224, SHA256, SHA384, SHA512 | |
var HMACAlgorithm: CCHmacAlgorithm { | |
var result: Int = 0 | |
switch self { | |
case .MD5: result = kCCHmacAlgMD5 | |
case .SHA1: result = kCCHmacAlgSHA1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// API access key from Google API's Console | |
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); | |
$registrationIds = array( $_GET['id'] ); | |
// prep the bundle | |
$msg = array |