Skip to content

Instantly share code, notes, and snippets.

View Abizern's full-sized avatar
🎧
Working from home

Abizer Nasir Abizern

🎧
Working from home
View GitHub Profile
@Abizern
Abizern / NSData+Base64.h
Created January 19, 2012 22:52
A category on NSData for coding and encoding Base64
//
// NSData+Base64.h
// base64
//
// Created by Matt Gallagher on 2009/06/03.
// Copyright 2009 Matt Gallagher. All rights reserved.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software. Permission is granted to anyone to
@Abizern
Abizern / .gitignore
Created November 21, 2010 12:45
Global git ignore file
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
// Scanner+Swift.swift
//
// A set of idiomatic swift extensions to Scanner
//
// Based on https://gist.github.com/natecook1000/59bb0c9117b555f5d40d
// Converted to Swift 3
//
import Foundation
@Abizern
Abizern / Python3File.py
Created March 6, 2011 18:55
Skeleton Python3 file template
#!/usr/bin/env python3 -tt
"""
Module documentation.
"""
# Imports
import sys
#import os
# Global variables
@Abizern
Abizern / loggingPrint.swift
Last active September 22, 2021 14:28
Debug logging for Swift
//
// LoggingPrint.swift
//
import Foundation
/**
Prints the filename, function name, line number and textual representation of `object` and a newline character into
the standard output if the build setting for "Active Complilation Conditions" (SWIFT_ACTIVE_COMPILATION_CONDITIONS) defines `DEBUG`.
@Abizern
Abizern / layer0.json
Created October 15, 2020 09:37 — forked from kajsa/layer0.json
Atreus 2 Chrysalis config
{
"keymap": [
{
"keyCode": 52,
"label": "'"
},
{
"keyCode": 54,
"label": ","
},
@Abizern
Abizern / RecursivePublisher.swift
Last active June 15, 2020 11:36
Recursive publisher
// I needed to fetch all the pages from a paged endpoint.
// In this specific case, the JSON results contained a `pagingStatus` section that provided extra information which I could use:
// Hiding that behind a protocol:
import Foundation
protocol PagedReturning {
var pagingStatus: PagingStatus { get }
}
@Abizern
Abizern / Template.swift
Created December 8, 2019 20:42 — forked from paulweichhart/Template.swift
SwiftUI Playground Template
import Foundation
import PlaygroundSupport
import SwiftUI
struct Content: View {
var body: some View {
Text("👋🏻, 🌍!")
}
}
@Abizern
Abizern / uuidgen.m
Created December 20, 2011 11:51
A method that returns a UUID in an ARC environment.
- (NSString *)uuidString {
// Returns a UUID
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
NSString *uuidStr = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
CFRelease(uuid);
return uuidStr;
}
@Abizern
Abizern / NSDate+RandomDate.h
Last active June 7, 2017 12:24
Category on NSDate to return a random date in the same year as itself.
//
// NSDate+RandomDate.h
//
//
#import <Foundation/Foundation.h>
@interface NSDate (RandomDate)
- (NSDate *)randomDateInYearOfDate;