Skip to content

Instantly share code, notes, and snippets.

View mingsai's full-sized avatar
🎯
Focusing

Tommie N. Carter, Jr. mingsai

🎯
Focusing
View GitHub Profile
@mingsai
mingsai / index.js
Created May 12, 2016 21:56 — forked from jessedc/index.js
Clout Kit Web Services using server to server token
(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 / cloudkit-server.php
Created May 12, 2016 21:56 — forked from NSURLSession0/cloudkit-server.php
CloudKit server-to-server in 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 / cloudkit-request.js
Created May 12, 2016 21:57 — forked from spllr/cloudkit-request.js
Setting up an authenticated CloudKit server-to-server request
/**
* 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 / osx-software-update-urls.txt
Created August 3, 2016 14:20 — forked from geoff-nixon/osx-software-update-urls.txt
URLs of the index files used by the software update client on OS X
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 / firebase_detect_data.js
Created April 18, 2017 10:53 — forked from anantn/firebase_detect_data.js
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
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 / RSSFeed.swift
Created January 15, 2019 09:56 — forked from kharrison/RSSFeed.swift
Swift Decodable With Multiple Custom Dates
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
//--------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1
// https://swiftui-lab.com/swiftui-animations-part2
//--------------------------------------------------
import SwiftUI
struct ContentView: View {
var body: some View {
@mingsai
mingsai / UIViewController+SwiftUI.swift
Created September 23, 2019 01:18 — forked from timothycosta/UIViewController+SwiftUI.swift
Using UIViewController via the SwiftUI Environment
//
// UIViewController+SwiftUI.swift
//
// Created by Timothy Costa on 2019/07/04.
// Copyright © 2019 timothycosta.com. All rights reserved.
//
import SwiftUI
struct ViewControllerHolder {
@mingsai
mingsai / clapping_hands.dart
Last active December 4, 2019 21:38 — forked from Kartik1607/main.dart
Clapping Hands
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
import 'package:flutter/material.dart';
import 'dart:math' as math;
import 'dart:async';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {