Skip to content

Instantly share code, notes, and snippets.

Avatar
🔬
R&D

Maz Jaleel Mazyod

🔬
R&D
View GitHub Profile
View UIViewController+DismissOnTapOutside.h
//
// UIViewController+DismissOnTapOutside.h
// Telly
//
// Created by Mazyad Alabduljaleel on 5/8/14.
// Copyright (c) 2014 Telly, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
View BlankSprite.cpp
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 Aug 29, 2015
Cross platform shapes images using CGImage. Elegantly created using swift and swifty conventions. See more at https://github.com/Mazyod/MazKit
View CGImage+Shapes
//
// CGImage+Shapes.swift
// MazKit
//
// Created by Mazyad Alabduljaleel on 3/22/15.
// Copyright (c) 2015 ArabianDevs. All rights reserved.
//
import CoreGraphics
View adams-heroku-values.md

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 Oct 7, 2015
recursively get files with certain data type from NSBundle
View recursive-bundle.swift
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 Nov 5, 2015
Nullablility Oriented Programing
View NullabilityProtocol.swift
public protocol StoreEntryNullability {}
public struct StoreEntryNullable: StoreEntryNullability {}
public struct StoreEntryNonnull: StoreEntryNullability {}
public protocol StoreGroup {
typealias StorageType
typealias StorageNullability: StoreEntryNullability
}
View GenericKVStore.java
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 Jan 5, 2016
Poco C++ Backend Starter Dockerfile
View 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 Oct 2, 2016
Max slice explained
View max_slice.py
# 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, ...]
View bad_rust.rs
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<()> {