Skip to content

Instantly share code, notes, and snippets.

View hery's full-sized avatar

hery

View GitHub Profile
@hery
hery / gist:127ff82e0c760333603b01f9d61f28cb
Last active February 20, 2017 15:11
Valid Slack Channel Name
def valid_channel_name(name):
"""Channel names can only contain lowercase letters,
numbers, hyphens, and underscores, and must be 21 characters or less.
Some sample conversions from Slack to determine some heuristics:
1..................20abc def => 1_20abc-def
1..................20abc..def => 1_20abc_def
Heuristics:
1. Encode input into ASCII
@hery
hery / gist:d479478986ec5d9a7b85
Last active August 29, 2015 14:19
Transform Your (OS X) Box Into a Radio
Prerequisites
* SHOUTcast (http://www.shoutcast.com/BroadcastNow)
* Soundflower (https://rogueamoeba.com/freebies/soundflower/)
* butt (http://butt.sourceforge.net/)
* a computer
Set up Soundflower
* After installing Soundflower, set it as Output source in System Preferences
@hery
hery / gist:986e2d624229b4781742
Created October 28, 2014 16:09
SourceKitService Bug
let intArray = [
[0xff2929, 0x00bdd1],
[0x00ea00, 0xff4fff],
[0x00bdd1, 0xbd10e0],
[0x00ea00, 0x00bdd1],
[0xbd10e0, 0xff2929],
[0xff4fff, 0x00bdd1],
[0x00bdd1, 0x00ea00],
[0xff2929, 0x00ea00],
[0x00bdd1, 0xff2929],
2014-05-10 22:14:41.541 Chelsea[3454:60b] Searching for venues...
2014-05-10 22:14:41.555 Chelsea[3454:60b] Auth token for request: KAOMWNNZOW1OGCGODJIWAZRLG5KAPLMGBFIGX5JKYJ2JVT53
2014-05-10 22:14:41.556 Chelsea[3454:60b] Verified date for request: 20140417
2014-05-10 22:14:41.557 Chelsea[3454:60b] Request parameter dictionary: {
intent = checkin;
limit = 5;
ll = "40.720272,-74.010767";
"oauth_token" = KAOMWNNZOW1OGCGODJIWAZRLG5KAPLMGBFIGX5JKYJ2JVT53;
query = home;
radius = 1000;
- (NSArray *)getLinesArrayOfStringInLabel:(UILabel *)label
{
NSString *text = [label text];
UIFont *font = [label font];
CGRect rect = [label frame];
CTFontRef myFont = CTFontCreateWithName((__bridge CFStringRef)([font fontName]), [font pointSize], NULL);
NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:text];
[attStr addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)myFont range:NSMakeRange(0, attStr.length)];