Skip to content

Instantly share code, notes, and snippets.

View mladjan's full-sized avatar

Mladjan Antic mladjan

View GitHub Profile
@xslim
xslim / gist:851018
Created March 2, 2011 14:32
HTML to NSAttributedString
//
// NSAttributedString+fromHTML.m
// Berlingske
//
// Created by Taras Kalapun on 18.08.10.
// Copyright (c) 2010 Ciklum. All rights reserved.
//
#import "NSAttributedString+fromHTML.h"
@skiyo
skiyo / gist:3162852
Created July 23, 2012 09:49
NSUserNotificationCenter
//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];
@radianttap
radianttap / AppleiOS6MapsLegallink.m
Created September 17, 2012 10:47
Remove Legal link in Apple Maps
@radianttap
radianttap / gist:4484269
Last active December 10, 2015 19:48 — forked from anonymous/gist:4468522
Pulse view
+ (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;
@ChangJoo-Park
ChangJoo-Park / gist:5443017
Last active January 29, 2019 20:55
# Ubuntu 13.04 , linux mint install RVM with Ruby 2.0.0-p353 , Rails 4.0.0
# 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
@JaviSoto
JaviSoto / gist:5504598
Created May 2, 2013 19:12
iOS Debug display image function
/**
* @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);
@radianttap
radianttap / wwdchd.sh
Created June 4, 2014 09:14
Download HD session from WWDC 2014
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
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