Skip to content

Instantly share code, notes, and snippets.


Adrian Tofan adriantofan

View GitHub Profile
View github collapsable long code snippet
adriantofan / edge-lb-api.json
Created December 16, 2019 14:11
View edge-lb-api.json
"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"
adriantofan / gist:a17e80030e48cc44392755398f3df49a
Created December 20, 2018 13:46
how to process bash params
View gist:a17e80030e48cc44392755398f3df49a
if [ "$#" -lt 3 ]; then
echo "Usage: ./ project-name bucket-name classname [options] "
echo "Example: ./ cloud-training-demos cloud-training-demos CurrentConditions --bigtable"
View gist:fec9299349fc5c021d1eb2ac50e27192
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)
adriantofan / outputStreamToFileAtPathDemo.m
Last active August 29, 2015 14:26 — forked from mingchen/outputStreamToFileAtPathDemo.m
How to use NSOutputStream's outputStreamToFileAtPath
View outputStreamToFileAtPathDemo.m
- (void)outputStreamToFileAtPathDemo
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *file = [documentsDirectory stringByAppendingPathComponent:@"foo.dat"];
NSLog(@"file: %@", file);
NSOutputStream *output = [NSOutputStream outputStreamToFileAtPath:file append:NO];
[output open];
adriantofan / gist:ca867ce2f537996ec1bc
Created June 25, 2015 12:43
preprocessor objective-c
View gist:ca867ce2f537996ec1bc
The ' ## ' preprocessing operator performs token pasting.
#define macro(x) ## x \\gets replaced by the value of x
Stringification # x makes x in to a string so @#x in objective-c
View gist:999d36b0b4efc56edcc5
git show-ref --tags
git format-patch -n --stdout sha >file
git am file
adriantofan /
Last active August 29, 2015 14:23 — forked from osteslag/
# Script for managing build and version numbers using git and agvtool.
# Change log:
# v1.0 18-Jul-11 First public release.
# v1.1 29-Sep-12 Launch git, agvtool via xcrun.
version() {
adriantofan / ProductCreateHeader.xib
Last active August 29, 2015 14:19
table view self sizing header
View ProductCreateHeader.xib
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="" version="3.0" toolsVersion="7531" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<plugIn identifier="" version="7520"/>
<customFonts key="customFonts">
<mutableArray key="FreightSansPro-Book.otf">