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
<?php
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php');
include_once "google-api-php-client/examples/templates/base.php";
$client = new Google_Client();
/************************************************
ATTENTION: Fill in these values, or make sure you
have set the GOOGLE_APPLICATION_CREDENTIALS
import Foundation
import Compression
/// A convenience class for compressing an NSData object.
///
/// Example:
/// ```
/// let compression = Compression(algorithm: .ZLIB)
/// let compressedData = compression.compressData(data)
/// let decompressedData = compresison.decompressData(compressedData)
@gitbricho
gitbricho / file01_01.swift
Last active May 7, 2016 10:44
swift 2.1 ファイル
import UIKit
//## iOS:ファイルシステム #####
//標準ディレクトリ ( Documents/, Library/, tmp/ ... )
//## OS X:ファイルシステム #####
//ローカルドメイン ( Applications/Utilities, Developer/, Library/ )
//ユーザードメイン ( Users/user1, ... )
//ファイルまたはディレクトリのパス
@alekseypotapov-dev
alekseypotapov-dev / SwiftC.swift
Created December 4, 2015 15:51
Swift with C example
//original video https://realm.io/news/pragma-chris-eidhof-swift-c/
import Foundation
extension Comparable {
static func compare (l: UnsafePointer<Void>, _ r: UnsafePointer<Void>) -> Int32 {
let left: Self = UnsafePointer(l).memory
let right: Self = UnsafePointer(r).memory
if left < right { return -1 }
if left == right { return 0 }
@karlkranich
karlkranich / apitest.php
Last active July 17, 2018 14:49
Updated PHP code to use the Google Sheets API. See usage instructions at http://karl.kranich.org/2015/04/16/google-sheets-api-php/ More examples at https://gist.github.com/karlkranich/afa39e3d778455b38c38
<?php
// apitest.php
// by Karl Kranich - karl.kranich.org
// version 3.1 - edited query section
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php');
include_once "google-api-php-client/examples/templates/base.php";
$client = new Google_Client();
@idStar
idStar / SpreadsheetExportToCSV.scpt
Last active March 8, 2020 03:57
Export spreadsheet to UTF8 CSV using Numbers 3.6 on a Mac with AppleScript
#! /usr/bin/osascript
(*
---------------------------------------------------------------------------------
Script: SpreadsheetExportToCSV
Command-line tool to convert a spreadsheet document to CSV
This AppleScript is tested with and compatible with Apple iWork Numbers 3.6,
current as at October 23, 2015.
@geoff-nixon
geoff-nixon / osx-software-update-urls.txt
Created September 23, 2015 08:04 — forked from stefanschmidt/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
@baileysh9
baileysh9 / Parsing_productids.swift
Last active February 17, 2017 17:05
Parsing Product Ids from Receipt in Swift
func getProductIdFromReceipt(_ data:Data) -> String? //Swift 2: func getProductIdFromReceipt(data:NSData) -> String?
{
//Swift 2: var p = UnsafePointer<UInt8>(data.bytes)
//Swift 3
var p : UnsafePointer? = (data as NSData).bytes.bindMemory(to: UInt8.self, capacity: data.count)
let dataLength = data.length
var type:Int32 = 0
var tag:Int32 = 0
import Firebase from 'firebase';
import Promise from 'bluebird';
import {ValidationError} from './lib/validation';
import {firebaseCursor} from './state';
// if (!process.env.IS_BROWSER) {
// // TODO: Set Firebase for server.
// }
export const TIMESTAMP = Firebase.ServerValue.TIMESTAMP;
@soyoes
soyoes / OBJC Tips
Last active October 17, 2018 16:46
OBJC Tips
* strong, weak, assign
http://stackoverflow.com/questions/8927727/objective-c-arc-strong-vs-retain-and-weak-vs-assign
* bridge (void* => id, id => void*)
http://stackoverflow.com/questions/18976016/how-to-specify-property-to-c-pointer-in-arc-environment
* arr.indexOf
```Objective-C
//BAD: it returns max int.
(int)[arr indexOfObject:obj]>0