Skip to content

Instantly share code, notes, and snippets.

View Mazyod's full-sized avatar
🤖
Unlocking LLMs

Maz Mazyod

🤖
Unlocking LLMs
View GitHub Profile
//
// UIViewController+DismissOnTapOutside.h
// Telly
//
// Created by Mazyad Alabduljaleel on 5/8/14.
// Copyright (c) 2014 Telly, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
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);
@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

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 / 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 {
@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 / GenericKVStore.java
Created November 10, 2015 20:22
Java Generics
import java.util.HashMap;
import java.util.Map;
public class Driver {
static Map<String, Object> KeyValueStore = new HashMap<String, Object>();
public static void main(String[] args) throws Exception {
@Mazyod
Mazyod / Dockerfile
Last active January 5, 2016 19:40
Poco C++ Backend Starter Dockerfile
FROM ubuntu
MAINTAINER Maz Jaleel <mazjaleel@gmail.com>
# Install necessary tools to build Poco
RUN apt-get update && apt-get install -yq \
unzip wget build-essential cmake \
openssl libssl-dev \
unixODBC unixODBC-dev odbc-postgresql
@Mazyod
Mazyod / max_slice.py
Created October 2, 2016 01:42
Max slice explained
# starting array
A = [5, -2, 10, 3, -25, 12, 6]
# calculating the max slice in O(n), starting from A[1]
# copy A into S, where the max slices are stored
S = A[:]
# instead of looping, I'll unroll the loop for simplicity
# so, at S[1], we either add the previous sum, or start over
# to decide that, we simply check the max between the element and the previous sum added
S[1] = max(S[1], S[1] + S[0])
# S = [5, 3, ...]
extern crate redis;
use redis::Commands;
use std::net::{TcpListener, TcpStream};
use std::thread;
use std::io::Read;
fn handle_client(mut stream: TcpStream) -> redis::RedisResult<()> {