Skip to content

Instantly share code, notes, and snippets.

View allenpc's full-sized avatar

Allen Chen allenpc

View GitHub Profile
@allenpc
allenpc / UIColor+HexString.h
Last active August 29, 2015 14:00
Create a UIColor from a hex value. Supports Android-style #ARGB values. Courtesy of Micah Hainline (http://stackoverflow.com/questions/1560081/how-can-i-create-a-uicolor-from-a-hex-string)
//
// UIColor+HexString.h
//
#import <Foundation/Foundation.h>
@interface UIColor (HexString)
+ (UIColor *)colorWithHexString:(NSString *)hexString;
@irace
irace / BIWebViewDelegate.m
Created September 10, 2012 02:51
JavaScript/native bridge for iOS's UIWebView
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSString *urlString = [[request URL] absoluteString];
if ([urlString hasPrefix:@"js:"]) {
NSString *jsonString = [[[urlString componentsSeparatedByString:@"js:"] lastObject]
stringByReplacingPercentEscapes];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
@LeverOne
LeverOne / LICENSE.txt
Created October 24, 2011 04:17 — forked from jed/LICENSE.txt
generate random v4 UUIDs (107 bytes)
DO WTF YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Alexey Silin <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WTF YOU WANT TO PUBLIC LICENSE
@sharoonthomas
sharoonthomas / bitbucket.py
Created June 4, 2011 04:54
Script to display all issues in all projects/repositories of bitbucket
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Get all your bitbucket issues at once-Fetches/Displays your bitbucket issues
-
:copyright: (c) 2011 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
-
The username and password for this program can be set in multiple ways.
-
1. Set environment variable