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
@mingsai
mingsai / RSSFeed.swift
Created Jan 15, 2019 — forked from kharrison/RSSFeed.swift
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
@mingsai
mingsai / firebase_detect_data.js
Created Apr 18, 2017 — forked from anantn/firebase_detect_data.js
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
View firebase_detect_data.js
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');
@mingsai
mingsai / osx-software-update-urls.txt
Created Aug 3, 2016 — forked from geoff-codes/osx-software-update-urls.txt
URLs of the index files used by the software update client on OS X
View osx-software-update-urls.txt
10.3 (Panther):
https://swscan.apple.com/scanningpoints/scanningpointX.xml
10.4 (Tiger):
https://swscan.apple.com/content/catalogs/index.sucatalog
https://swscan.apple.com/content/catalogs/index-1.sucatalog
10.5 (Leopard):
https://swscan.apple.com/content/catalogs/others/index-leopard.merged-1.sucatalog
@mingsai
mingsai / cloudkit-request.js
Created May 12, 2016 — forked from spllr/cloudkit-request.js
Setting up an authenticated CloudKit server-to-server request
View cloudkit-request.js
/**
* Demonstrates how to use Apple's CloudKit server-to-server authentication
*
* Create private key with: `openssl ecparam -name prime256v1 -genkey -noout -out eckey.pem`
* Generate the public key to register at the CloudKit dashboard: `openssl ec -in eckey.pem -pubout`
*
* @see https://developer.apple.com/library/prerelease/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/SettingUpWebServices/SettingUpWebServices.html#//apple_ref/doc/uid/TP40015240-CH24-SW6
*
* @author @spllr
*/
@mingsai
mingsai / cloudkit-server.php
Created May 12, 2016 — forked from Mauricevb/cloudkit-server.php
CloudKit server-to-server in PHP
View cloudkit-server.php
<?php
// Constants
$KEY_ID = 'YOUR_KEY_ID';
$CONTAINER = 'YOUR_CONTAINER';
$PRIVATE_PEM_LOCATION = 'eckey.pem'; // Store this file outside the public folder!
// Config
$url = 'https://api.apple-cloudkit.com/database/1/' . $CONTAINER . '/development/public/records/query';
$body = '{"query":{"recordType":"Articles"}}';
@mingsai
mingsai / index.js
Created May 12, 2016 — forked from jessedc/index.js
Clout Kit Web Services using server to server token
View index.js
(function() {
/**
* This is an example fetching /users/current from cloud kit with a server to server token without utilising aplpe's cloudkit.js
* https://developer.apple.com/library/ios/samplecode/CloudAtlas/Listings/Node_node_client_s2s_index_js.html#//apple_ref/doc/uid/TP40014599-Node_node_client_s2s_index_js-DontLinkElementID_22
*/
const https = require('https');
var fs = require('fs');
var crypto = require('crypto');
@mingsai
mingsai / MultiExporter.jsx
Created May 1, 2016 — forked from TomByrne/MultiExporter.jsx
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
View MultiExporter.jsx
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org
@mingsai
mingsai / gist:9db593f182a11235d8c3
Created Feb 16, 2016 — forked from casademora/gist:d06e69288fb24c9ace6e
Extension to writeTo NSOutputStream
View gist:9db593f182a11235d8c3
extension String
{
func writeTo(outputStream:NSOutputStream)
{
if let data = self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
{
let bytes = ConstUnsafePointer<UInt8>(data.bytes)
outputStream.write(bytes, maxLength: data.length)
}
}
View OrdinalNumberFormatter.swift
//
// OrdinalNumberFormatter.swift
// Tastify
//
// Created by Ian Grossberg on 10/1/15.
// Copyright © 2015 Noble Desktop. All rights reserved.
//
import Foundation
@mingsai
mingsai / Router.swift
Created Feb 15, 2016 — forked from janporu-san/Router.swift
Uploading a file with SWIFT via POST multipart/form-data (PHP)
View Router.swift
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:
You can’t perform that action at this time.