Skip to content

Instantly share code, notes, and snippets.

View Mazyod's full-sized avatar
🤖
Unlocking LLMs

Maz Mazyod

🤖
Unlocking LLMs
View GitHub Profile
@Mazyod
Mazyod / NullabilityProtocol.swift
Created November 5, 2015 19:30
Nullablility Oriented Programing
public protocol StoreEntryNullability {}
public struct StoreEntryNullable: StoreEntryNullability {}
public struct StoreEntryNonnull: StoreEntryNullability {}
public protocol StoreGroup {
typealias StorageType
typealias StorageNullability: StoreEntryNullability
}
@Mazyod
Mazyod / recursive-bundle.swift
Last active October 7, 2015 22:33
recursively get files with certain data type from NSBundle
extension NSBundle {
func recursivePathsForResources(type type: String) -> [NSURL] {
// Enumerators are recursive
let enumerator = NSFileManager.defaultManager().enumeratorAtPath(bundlePath)
var filePaths = [NSURL]()
while let filePath = enumerator?.nextObject() as? String {

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@Mazyod
Mazyod / CGImage+Shapes
Last active August 29, 2015 14:17
Cross platform shapes images using CGImage. Elegantly created using swift and swifty conventions. See more at https://github.com/Mazyod/MazKit
//
// CGImage+Shapes.swift
// MazKit
//
// Created by Mazyad Alabduljaleel on 3/22/15.
// Copyright (c) 2015 ArabianDevs. All rights reserved.
//
import CoreGraphics
Sprite *createBlankSprite(const Color4B& color, Size size)
{
GLubyte *buffer = (GLubyte *)malloc(sizeof(GLubyte)*4);
buffer[0] = color.r;
buffer[1] = color.g;
buffer[2] = color.b;
buffer[3] = color.a;
auto tex = new Texture2D();
tex->initWithData(buffer, sizeof(GLubyte)*4, Texture2D::PixelFormat::RGBA8888, 1, 1, size);
//
// UIViewController+DismissOnTapOutside.h
// Telly
//
// Created by Mazyad Alabduljaleel on 5/8/14.
// Copyright (c) 2014 Telly, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>