Skip to content

Instantly share code, notes, and snippets.

View LeffelMania's full-sized avatar

Alex Leffelman LeffelMania

  • Remind
  • Milwaukee
View GitHub Profile
@LeffelMania
LeffelMania / A_UUID_v7_for_Swift.swift
Last active October 30, 2023 20:15
Swift UUID v7
import Foundation
/*
https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-01.html#name-uuidv7-layout-and-bit-order
Binary Structure (128 bits):
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
┌─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┐
│ unix_ts_ms │
@LeffelMania
LeffelMania / Rules
Created January 13, 2016 22:42
Credit Card Problem (Swift)
/*
# Step 1
#+------------------------------------+------------------------------------------------------------+--------+
#| Issuing network | Card prefixes | Length |
#+------------------------------------+------------------------------------------------------------+--------+
#| American Express | 34, 37 | 15 |
#| Diners Club International | 36 | 14 |
# Step 2 (Multple lengths, overlap in rules between Visa and Visa Electron)
@LeffelMania
LeffelMania / main.m
Last active August 29, 2015 14:00
iOS Refactor
// Create a new command-line project in Xcode by going to
// File -> New -> Project
// Under "OS X" select "Application" and "Command Line Tool"
// Name the product whatever you want and set the type to "Foundation"
// Replace the created main.m file with this file
#import <Foundation/Foundation.h>
@interface Email : NSObject
@LeffelMania
LeffelMania / UIView+FrameUtil.h
Created February 17, 2014 07:38
UIView+FrameUtil - Easy and expressive UIView frame manipulation
#import <UIKit/UIKit.h>
@interface UIView (FrameUtil)
@property (nonatomic, assign) CGPoint origin;
@property (nonatomic, assign) CGSize size;
@property (nonatomic, assign) CGFloat x, y, width, height;
@property (nonatomic, assign) CGFloat left, top, right, bottom;
@end