This file contains 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
#pragma strict | |
import MiniJSON; | |
import System.Collections.Generic; | |
class JsonData { // UnityScript only; impossible in JavaScript | |
var root : Dictionary.<String,System.Object>; //root of string: root = {"data":"data",...} | |
var array : List.<System.Object>; | |
var object : Obj; //another json string | |
var string : String; |
This file contains 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
import Foundation | |
import Alamofire | |
import ModelRocket | |
class ImageUploader { | |
static func uploadImage(image : UIImage, | |
parameters: [String: String]? = nil, | |
completionSuccess: (result: JSON) -> Void, | |
completionError: (error: NSError) -> Void) { |
This file contains 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
{ | |
"dbname": { | |
"host": "localhost", | |
"port": 5432, | |
"database": "mydatabase", | |
"password": "user123", | |
"name": "dbname", | |
"user": "user", | |
"connector": "postgresql" | |
} |
This file contains 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
//Function to pretty-print Json Object in Swift 3 | |
func prettyPrint(with json: [String:Any]) -> String{ | |
let data = try! JSONSerialization.data(withJSONObject: json, options: .prettyPrinted) | |
let string = NSString(data: data, encoding: String.Encoding.utf8.rawValue) | |
return string as! String | |
} |
This file contains 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
// Dictionary/JSON Extension | |
// Pretty Print Json Objects | |
// | |
// Created by Domene on 10/02/17. | |
// | |
import Foundation | |
extension Dictionary where Key == String, Value == AnyObject { | |
func prettyPrint() -> String{ |
This file contains 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
/* | |
* In this example we will examine three different ways | |
* of using 'this' context inside a closure in javascript | |
* | |
* Suppose we have a Player class in which we'll play the next | |
* song as soon as it receives an 'onended' event from the Audio object | |
*/ | |
var Player = function(){ | |
this.songList = ['path/to/audio1.mp3', 'path/to/audio2.mp3'] | |
this.currentAudio = new Audio(this.songList[0]) |
This file contains 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
// | |
// CustomMask.swift | |
// | |
// Created by Domene on 4/6/16. | |
// | |
import Foundation | |
/* | |
* CustomMask takes a string and returns it with the matching pattern |
This file contains 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
// | |
// SequenceCustomMaskTextField.swift | |
// | |
// Created by Domene on 02/02/17. | |
// | |
import Foundation | |
import UIKit | |
@objc protocol SequenceCustomMaskTextFieldDelegate : UITextFieldDelegate{ |
This file contains 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
// | |
// Created by Eduardo Domene Junior on 19/04/2018. | |
// Make sure that your view controller in Attributes Inspector is marked as: | |
// * Presentation - Over the current context | |
// * Defines context | |
// * Provides context | |
import UIKit | |
class ModalTransparentBackground: UIViewController { |
This file contains 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 luhnCheck(_ number: String) -> Bool { | |
var sum = 0 | |
let digitStrings = number.reversed().map { String($0) } | |
for tuple in digitStrings.enumerated() { | |
if let digit = Int(tuple.element) { | |
let odd = tuple.offset % 2 == 1 | |
switch (odd, digit) { | |
case (true, 9): |
OlderNewer