This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
require 'moving_average' | |
mechanize = Mechanize.new | |
login_page = mechanize.get 'https://www.myfitnesspal.com/account/login' | |
form = login_page.forms.first | |
# noinspection RubyResolve | |
form.field_with(id: 'username').value = "username" | |
form.field_with(id: 'password').value = "pass" | |
form.submit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://developer.apple.com/videos/wwdc/2014/ | grep -iIoh 'http.*._hd_.*dl=1">HD' | sed -e 's/\?dl=1">HD//g' | xargs -n1 wget -N |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @discussion takes the passed image parameter and displays a view controller modally that shwos the image | |
* You can call it from the debugger like this: | |
* expr JSDebugDisplayImage(image) | |
* @note you can dismiss the view controller simply by tapping on it | |
*/ | |
extern void JSDebugDisplayImage(UIImage *image); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you meet install errors, see abid-hussain's comment | |
sudo apt-get --force-yes install build-essential openssl libreadline6 libreadline6-dev curl git-core \ | |
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \ | |
libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison | |
&& | |
\curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (void)pulseView:(UIView *)view completion:(void (^)(void))block { | |
// if you use auto layout, view-based transform go haywire, as they trigger layoutSubviews | |
// consequence is that you have no idea where the view will end up on the screen once animation completes | |
// see this discussion: http://stackoverflow.com/questions/12943107/how-do-i-adjust-the-anchor-point-of-a-calayer-when-auto-layout-is-being-used | |
// thus (per solution 4 from link above), rewriting with CAKeyframeAnimation | |
CAKeyframeAnimation *ka = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; | |
ka.duration = .49; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hide Legal link in the bottom left corner of Apple maps in iOS 6 | |
for (UIView *v in [self.map subviews]) { | |
NSLog(@"%@", NSStringFromClass([v class])); | |
if ([NSStringFromClass([v class]) isEqualToString:@"MKAttributionLabel"]) { | |
v.hidden = YES; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initalize new notification | |
NSUserNotification *notification = [[NSUserNotification alloc] init]; | |
//Set the title of the notification | |
[notification setTitle:@"My Title"]; | |
//Set the text of the notification | |
[notification setInformativeText:@"My Text"]; | |
//Set the time and date on which the nofication will be deliverd (for example 20 secons later than the current date and time) | |
[notification setDeliveryDate:[NSDate dateWithTimeInterval:20 sinceDate:[NSDate date]]]; | |
//Set the sound, this can be either nil for no sound, NSUserNotificationDefaultSoundName for the default sound (tri-tone) and a string of a .caf file that is in the bundle (filname and extension) | |
[notification setSoundName:NSUserNotificationDefaultSoundName]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSAttributedString+fromHTML.m | |
// Berlingske | |
// | |
// Created by Taras Kalapun on 18.08.10. | |
// Copyright (c) 2010 Ciklum. All rights reserved. | |
// | |
#import "NSAttributedString+fromHTML.h" |