Skip to content

Instantly share code, notes, and snippets.

Tommie N. Carter, Jr., BSIT, MBA mingsai

Block or report user

Report or block mingsai

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phpfiddle
phpfiddle / fiddle_085440.php
Created Jul 17, 2019
[ Posted by Tommie C ] Convert PHP object to array using JSON methods
View fiddle_085440.php
<?php
$nested_object = new stdClass;
$nested_object->apple = "apple value";
$nested_object->orange = "orange value";
$nested_object->grape = "grape value";
$nested_object->pear = "pear value";
$array = json_decode(json_encode($nested_object), true);
var_dump($nested_object, "object converted to array using json methods" , $array);
?>
View InfoPlist_3.swift
do {
  let appPList = try PListFile<InfoPList>()
 
  // then read values
  let url = appPList.data.configuration.url // it’s an URL
} catch let err {
  print(“Failed to parse data: \(err)”)
}
@kharrison
kharrison / RSSFeed.swift
Last active Apr 12, 2019
Swift Decodable With Multiple Custom Dates
View RSSFeed.swift
import Foundation
extension DateFormatter {
static let iso8601Full: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
formatter.calendar = Calendar(identifier: .iso8601)
formatter.timeZone = TimeZone(secondsFromGMT: 0)
formatter.locale = Locale(identifier: "en_US_POSIX")
return formatter
@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017
Obfuscation of hard-coded security-sensitive strings.
View Obfuscator.swift
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
View url-schemes-settings-ios.mkd

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@kevivforever
kevivforever / Cloud function
Last active May 30, 2019
Firebase cloud Function to read data change on one child. Join data from two childs and write to third child
View Cloud function
//Read data change on your ref
exports.functionname = functions.database.ref('/Items/{itemid}')
.onWrite(event => {
const item = event.data.val();
// read data once from second node
const locationRef = event.data.adminRef.root.child('location').child(event.params.itemid);
locationRef.once('value').then(snapshot =>{
const location = snapshot.val();
const city = location.city;
// data node where you want to write data
@Gerst20051
Gerst20051 / copy_latest_simulator_app_to_desktop.sh
Created Nov 23, 2016
Copy Latest Simulator App To Desktop Bash Script
View copy_latest_simulator_app_to_desktop.sh
#!/bin/bash
DESTINATION_DIR="$HOME/Desktop"
APP_PATH=$(find ~/Library/Developer/CoreSimulator/Devices/*/data/Containers/Bundle/Application/*/*.app -type d -maxdepth 0 -print0 | xargs -0 ls -td | head -n1)
APP_DIRNAME=$(dirname "$APP_PATH")
APP_BASENAME=$(basename "$APP_PATH")
FILE_EXTENSION="${APP_BASENAME##*.}"
FILE_NAME="${APP_BASENAME%.*}"
cd "$APP_DIRNAME"
View Obfuscator.swift
//
// Obfuscator.swift
// SwiftObfuscatorExample
//
// Created by Mathieu White on 2016-07-03.
// Copyright © 2016 Mathieu White. All rights reserved.
//
import Foundation
@T-Pham
T-Pham / AlamofireSwiftyJSONSerializer.swift
Last active Mar 15, 2017
Alamofire SwiftyJSON Serializer
View AlamofireSwiftyJSONSerializer.swift
//
// AlamofireSwiftyJSONSerializer.swift
//
// Created by Thanh Pham on 7/21/16.
//
import Alamofire
import SwiftyJSON
extension Request {
@drunknbass
drunknbass / EnvConfig.swift
Created Jun 17, 2016
Firebase stage + Prod config
View EnvConfig.swift
import Foundation
@objc(EnvConfig)
class EnvConfig: NSObject {
#if ENVConfigStaging
class var isProduction:Bool {
return false
}
You can’t perform that action at this time.