Skip to content

Instantly share code, notes, and snippets.

@jamztang
jamztang / 1a-LiveCameraView.m
Last active October 31, 2021 00:49
My first hackathon experience - 12 hours of hacking and building the essentials. https://medium.com/p/3db44088db70
- (void)viewDidLoad {
[super viewDidLoad];
self.videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionFront];
self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
// self.avatarView is a non full screen GPUImageView instance
// created in Storyboard
[self.videoCamera addTarget:self.avatarView];
[self.videoCamera startCameraCapture];
@jamztang
jamztang / LICENSE
Created January 6, 2012 18:28
Cancelable Scheduled Blocks in Objective-C
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@jamztang
jamztang / LICENSE
Last active November 2, 2019 22:33
UINibDecoderProxy - Use NSProxy to observe what's encoded when views and controllers are created in Interface Builder.
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
// hook.io handling Stripe
var stripe = require('stripe');
var url = require('url');
var querystring = require('querystring');
module.exports = function (hook) {
var req = hook.req;
var res = hook.res;
@jamztang
jamztang / LICENSE
Created January 6, 2012 18:48
Creating a placeholder UIImage dynamically with color
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@jamztang
jamztang / LICENSE
Created March 26, 2012 14:40
JTTargetActionBlock - Adding blocks support for UIControl target/action mechanism
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@jamztang
jamztang / Each.h
Created January 21, 2016 14:26
Generic HOM for NSArray
#import <Foundation/Foundation.h>
@interface Each <Object> : NSObject
@property (nonatomic, strong) NSArray <Object> *array;
- (instancetype)initWithArray:(NSArray <Object> *)array;
@end
@jamztang
jamztang / UITableViewDeleteActionResponder.m
Created June 28, 2012 08:08
Fixing the "delete" menu for UITableView shouldShowMenuForRowAtIndexPath
//
// Quick Hack to enable delete menu item
// Original blog post at http://mystcolor.me/post/26114988122/show-delete-menu-item-in-tableview
//
// Updated: 30 June 2012
// I realized there should really be a more elegant way to
// send actions to responder chain, without manually looping
// through the responder chain. Here we implement the
// delete: method in both UITableViewCell and UITableView, so
// that they know the right thing to do in their own delete:
@jamztang
jamztang / LICENSE
Last active December 25, 2015 03:59
Splitting an NSArray to several components
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@jamztang
jamztang / LICENSE
Created October 10, 2013 04:54
Adding drop shadow on UINavigationBar (before iOS 6)
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all