Skip to content

Instantly share code, notes, and snippets.

@iwarshak
iwarshak / Gemfile
Last active May 12, 2018 21:54
Here is what you need to get your Rubymotion application logs sent to papertrailapp.com. I am using Cocoalumberjack (CLJ) which seems to be the logging framework of choice for Cocoa, motion-logger which is a thin RM wrapper around Cocoalumberjack. CLJ allows you to write your own loggers, which is what PapertrailLogger is. It simply fires off lo…
source :rubygems
gem "rake"
gem 'motion-logger' #cocoalumberjack wrapper
In order for this to work you need ffmpeg. I tried with version 1.2.1.
1) Play the video you want to download in the browser
2) Inspect the video element on the page
3) Copy the video url from the page source (something like http://devstreaming.apple.com/videos/wwdc/2013/.../101/ref.mov)
4) In this url replace "ref.mov" with "iphone_c.m3u8" (for 960x540 resolution) or "atp.m3u8" if you want more (probably 720p?)
5) Execute `ffmpeg -y -i http://devstreaming.apple.com/videos/wwdc/2013/.../101/iphone_c.m3u8 output.mp4`
6) There is your video :)
@bensheldon
bensheldon / app_delegate.rb
Last active May 16, 2020 18:09
Creating a flat navigation bar in a RubyMotion iOS iPhone app. (screenshot in the comments)
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
# ...
navigation_appearance
#...
end
def navigation_appearance
# Background Color
@jorinvo
jorinvo / commands.md
Last active December 18, 2015 00:09
Scripts um Hubot auf Uberspace zu installieren.Für mehr Infos: http://jorinvogel.wordpress.com/2013/06/02/hubot-auf-uberspace-installieren/
  • hubot image me query - The Original. Queries Google Images for query and returns a random top result.

  • hubot animate me query - The same thing as image me, except adds a few parameters to try to return an animated GIF instead.

  • hubot mustache me url - Adds a mustache to the specified URL.

  • hubot mustache me query - Searches Google Images for the specified query and mustaches it.

  • hubot map me query - Returns a map view of the area returned by query.

  • hubot math me expression - Calculate the given expression.

  • hubot convert me expression to units - Convert expression to given units.

class MyCustomCell < UITableViewCell
# This method is used by ProMotion to instantiate cells.
def initWithStyle(style_name, reuseIdentifier: reuseIdentifier)
super
stylish
self
end
# A delegate method when the user clicks the Row(it's blue by default)
@alloy
alloy / gist:4952606
Last active August 19, 2020 03:48
Upload iOS application for clients on their iTunes Connect account.

Obviously, the simplest solution would be for the client to share their account details or add us as ‘team admin’, but that is not what this is about.

  1. [Add us to your iOS Developer Program as ‘team member’.][1]
  2. [Create a ‘Distribution Certificate’, if you haven’t got one already.][2]
  3. [Create a ‘App Store Distribution Provisioning Profile’.][3]
  4. [Export the ‘Distribution Certificate’ assets and send the export and password to us.][4] (For security sake, it’s a good idea to send us the password via other means than the exported certificate. E.g. by phone/SMS.)
@rais38
rais38 / gist:4683817
Last active October 13, 2020 17:36
Embed YouTube videos with UIWebView
#pragma mark - Embed Video
- (UIWebView *)embedVideoYoutubeWithURL:(NSString *)urlString andFrame:(CGRect)frame {
NSString *videoID = [self extractYoutubeVideoID:urlString];
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
@bf4
bf4 / ruby_learning.md
Last active July 17, 2021 08:06
Some Ruby Learning Resources
@colinta
colinta / hozizontal_pan_gesture.rb
Created January 17, 2013 18:49
Only responds to horizontal gestures, within 4 pixels of the starting location.
class HorizontalPanGestureRecognizer < UIPanGestureRecognizer
DirectionPanThreshold = 4
def initWithTarget(target, action: action)
super.tap do
my_reset
end
end
def touchesMoved(touches, withEvent:event)
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google