Skip to content

Instantly share code, notes, and snippets.

View adriantofan's full-sized avatar

Adrian Tofan adriantofan

View GitHub Profile
@adriantofan
adriantofan / gist:8c0cfc8872df54446476
Last active August 9, 2016 14:34
show custom fonts family names
for(NSString *fontfamilyname in [UIFont familyNames])
{
if (![fontfamilyname containsString:@"elvetica"]) {
continue;
}
NSLog(@"family:'%@'",fontfamilyname);
for(NSString *fontName in [UIFont fontNamesForFamilyName:fontfamilyname])
{
NSLog(@"\tfont:'%@'",fontName);
}
import Foundation
extension NSMutableOrderedSet {
struct rb {
static func insertSorted<T>(element: T, inTo set:NSMutableOrderedSet, isLessThan: (_ lhs:T,_ rhs:T) -> Bool){
for i in 0 ..< set.count {
let x = set[i] as! T
if !isLessThan(x,element) {
set.insert(element, at: i)
return
@adriantofan
adriantofan / gist:a17e80030e48cc44392755398f3df49a
Created December 20, 2018 13:46
how to process bash params
#!/bin/bash
if [ "$#" -lt 3 ]; then
echo "Usage: ./run_oncloud.sh project-name bucket-name classname [options] "
echo "Example: ./run_oncloud.sh cloud-training-demos cloud-training-demos CurrentConditions --bigtable"
exit
fi
PROJECT=$1
shift
BUCKET=$1
shift
@adriantofan
adriantofan / edge-lb-api.json
Created December 16, 2019 14:11
edge-lb-api
{
"data": [],
"meta": { "count": 0 },
"links": {
"first": "/1/edges?page=1&page_size=65535",
"last": "/1/edges?page=1&page_size=65535",
"next": null,
"prev": null,
"self": "/1/edges?page=1&page_size=65535"
}
<details>
<summary>Results</summary>
```
```
</details>