Shelby.tv Developer's Blog

There are only 10 types of people in the world. Those that understand binary and those that don't.



(Looking for the team blog?)
Recent Tweets @Shelby

danspinosa:

tl;dr; Delegation makes a thing more useful and flexible by letting others worry about details. iOS uses delegation a lot.

That’s pretty much it. If you can remember that, you can figure out everything else I hope to explain.

Let’s use an example. Open your contacts app on your phone. It’s…

tl;dr

  • Full Demo
  • cross-browser!
  • wrap input in a span (ie. .submit__input-wrapper)
  • .submit__input-wrapper should have height: 3.25em;
  • .submit__input-text should have height: inherit;

Read the full post on Mike’s blog here.

TL;DR: Harpy notifies users that a new version of your app is available and prompts them to download the app when your application launches.

I’ve noticed that many people ignore the red badge on the AppStore app on their iPhone home screen that signifies that there are new app updates. This causes users to get frustrated when their apps stop working.

Now, being someone who’s an iOS developer and an early adopter when it comes to software, I tend to have alphas, betas, or the latest version of software as soon as I hear about them. I don’t want to force this mentality on others, but if I’m updating an application of mine, there’s a damn good reason why I’m doing it, so I would like to see my users update their app as soon as its available.

Since I couldn’t find a tool that did this, and most of my apps don’t use push notifications, I decided to make my own little utility that solves this problem. It’s called Harpy, and it’s available for free on Github.  

Here’s how it works: When a user launches an app loaded with Harpy, an asynchronous request is sent to the iTunes store to check for the latest available version of your app. If that version doesn’t match the installed version, Harpy pushes an instance of UIAlertView to notify the user. When a user clicks on the Update button in the UIAlertView, it automatically takes them to the AppStore page for your app. That’s it! 

If you’re interested in Harpy, download it on Github.

Best,

Arthur / http://blog.sabintsev.com

(via artsabintsev-deactivated2014031)

Shelby Genius is available today in the iOS App Store! Download it here.

At Shelby.tv, we love video and we love new technology. And we’re
dedicated to giving our users new ways to discover and experience
video. Because the right video might inspire the next entrepreneur,
teach a future NHL player how to skate backwards for the first time,
or just make you laugh when you’re feeling down.

Shelby Genius is a brand new type of video search. While traditional
search engines (Google / YouTube, for example) are great at finding
specific information, they’re not always the best way to find new
sources of inspiration or entertainment. We think Shelby Genius is the
first step towards a more fun, fuzzy type of video discovery. It’s
where search meets serendipity.

Instead of a pure textual search of the video title or descriptions,
Shelby Genius is powered by what people like and share across the web.
We’ve been constructing our Shelby Video Graph for quite some time —
it tracks what people are sharing on Facebook, Twitter, Tumblr, etc.
When people share a video out on those social networks and blogs, it’s
a strong signal that the video had some special meaning to that person
— that either they liked it, or it made a strong impression on them
for some reason.

We use this large dataset of signals to do item-based filtering (a
type of collaborative filtering algorithm) to produce video
recommendations. It’s a very similar approach to how Amazon.com
produces their “Customers Who Bought This Item Also Bought…”
recommendations. We also take into account general popularity of video
shares to try to avoid recommending just the most viral videos all the
time.

We wrote a custom item-based filtering implementation in C that’s
optimized for speed and memory efficiency, which allows us to update
the recommendations frequently at a very reasonable cost, and it also
prepares us for incorporating video sharing information from even more
sources.

An iOS app seemed like the perfect way to debut Shelby Genius. We all
love using our iPhones to entertain ourselves for a few minutes here
and there, and Shelby Genius on iOS is a great way to find great new
videos to watch during that spare time. Also, if you have an Apple TV,
you can have Shelby Genius continuously play videos to your TV via
AirPlay (even when the app is in the background!), which is great for
parties (music videos) or settling down for an evening of longer
viewing.

So get out your iPhones and iPods (native iPad version is coming
soon!) and head over to the app store to download Shelby Genius.

And remember to share any great videos you find because you’ll be
contributing to even better, more serendipitous video discovery in the
future!

Another free iOS tool from our iOS developer, Arthur Sabintsev:

Features

  1. Works with Synchronous and Asyncrhonous calls
  2. Works with custom UITableViewDataSources and custom UITableViewDelegates
  3. Compatible with iOS 4, iOS 5, and iOS 6
  4. Compatible with iPhone and iPad
  5. Compatible with all device/interface orientations


Why should I use ASPullToRefresh?

While this code is compatible with every type of project, it may look unnecessarily complicated for most users. This class was made for users who like to create a single custom TableViewController class that has Pull-to-Refresh functionality, but reuse it multiple times with multiple UITableViewDataSources and UITableViewDelegates, which I, and other developers have come to call TableViewManagers


ASPullToRefresh v2.0.0 - Download it on GitHub.

(via artsabintsev-deactivated2014031)

Artur Sabintsev:

There are many iOS apps that require tons of images to be simultaneously downloaded, stored, and presented to the end-user without negatively impacting a user’s experience. Shelby.tv is one of these apps.

A couple months ago I put together a solution to this problem in the form of an asynchronous image downloader, with optional cache-storage, that also utilizes Apple’s Grand Central Dispatch technology to swiftly obtain, store, and present these images to the end user. I call it Asynchronous Freeloader.

My implementation is/does the following:

  • iOS 5+ Compatible
  • ARC Compliant
  • Image Scaling
  • Disk Caching with Garbage Collection
  • Support for Custom and Generic Placeholders
  • Multithreaded Image Downloading and Processing (via Grand Central Dispatch)

The best part, all of this functionality is yours with one line of code:

+ (void)loadImageFromLink:(NSString *)webLinkToImage 
  forImageView:(UIImageView *)imageView
  withPlaceholderView:(UIView*)placeholderView;

The code and README can be found on the project’s Github page.

Enjoy!

Great tool, Arthur! Thanks for sharing!

(via artsabintsev-deactivated2014031)

(Tumblr Dashboard readers: Click here to view the post with Github gists.)

Michael Matyus:

Here’s an awesome trick for DRYing up your COMPASS or SASS stylesheets.

While I was browsing the SASS Reference, I came across an understated little snippet called interpolation. The examples in the documentation don’t actually acknowledge the fact that you can interpolate variables into strings but I tried it anyway and it works.

Setup

All the icons in the new Shelby.tv app are maintained and displayed through the CSS as background images, rather than inlined in the HTML. Each image path is stored as a variable in the _base.scss partial.

#{$interpolation}

The SASS language has a feature called interpolation which means that the path to the images directory can be stored as a variable. In the gist below, you’ll notice that the file extension is also being interpolated.

Once that’s setup, the $shelby-logo is used as it normally would be used in the other partials:

Aye, there’s the rub

Run feature detection with Modernizr for the browsers that don’t support SVG (uh… like IE7/8). Modernizr will append a .no-svg class to the <html> element that we can leverage to style the fallbacks with.

Setup a partial called png.scss that will house all the stylings for the png files. Because of the way SASS and COMPASS compile partials, we can overwrite the $extension variable for only the png.scss partial.

[if IE] Conditional?

This is a bit of an extra step that ultimately depends on your situation. Let’s say the fallback stylesheet gets really big, you may want to wrap this file in an If ≤ IE9 conditional to prevent other browsers from downloading the extraneous resource.

Just remember to exclude png.scss from your master screen.scss!

tl;dr

  • Store paths and file extensions as variables
  • Interpolate variable syntax: #{$variable}
  • Create a easily maintainable png partial that overwrites the file extension variable
  • Maybe wrap the png.css file in some if ≤ IE9 conditionals in the head

artsabintsev:

A few weeks back, Vincent Iadevaia, the Lead Designer at Shelby.tv, provided me with some designs that required the use of a gradient on multiple UI elements. We decided it would be best to implement the gradient programmatically for each UI element, since this required less assets, and therefore, lessen the size of the iPhone app’s executable file.

In my quest to make this gradient, I found out that many issues arose when using the toll-free bridge between CFColorRef and UIColor. These were seemingly related to how ARC manages memory - the CFColorRef declarations and methods that depended on their values (e.g., CFArrayAppendValue, CGGradientRef) were being released from memory to quickly.

Below is a gist that anyone can include in a subclassed-UIView’s implementation file to achieve a programmatic, bridge-less, vertical, linear gradient in iOS 4+ using ARC.

(Tumblr Dashboard readers, view the gist here)

A visual example:

gradientsmotherfucker.com

(via artsabintsev-deactivated2014031)

git-animals:

git commit -a -m ‘stuffs’
git push
git revert HEAD

git animals are the best animals

git-animals:

git commit -a -m ‘stuffs’

git push

git revert HEAD

git animals are the best animals

(Tumblr Dashboard readers: click here to view the full Github Gists.)

danspinosa:

We’ve starting using settingslogic here at Shelby for the rebuild of our API and I must say, it’s pretty fine.  It’s simple to define constants in yaml and have them available in a namespaced, settings specific manner.  

The simple and direct way to use setingslogic is to put all of your settings into a single .yml file and just nest the crap out of them.  Well, if we did that, we’d end up with (lots of) code that looked like this:

But we thought it would be cleaner to use Settings as a module and create a new class for each top-level namespace so we could do stuff like this:

At first, our initializer was fairly small:

But that started growing quickly.  For each new settings namespace we added a .yml file and had to add a new Class definition inside settings.rb.  It was clear we needed to DRY (Don’t Repeat Yourself) it up.  

So I dusted off the Ruby meta-programming toolkit (a very powerful one that I don’t get to use day to day) and had a crack at it.  What I wanted was to just add a .yml file with settings and have it be available to me based on the name of that file.  If I created dan.yml I could now use Settings::Dan.whatever.

So, I loop through all the .yml files in my settings directory, create a new settings Class (which subclasses form Settingslogic) and initialize it just like before.  But here’s the rub: this new class is not available via a constant like classes normally are when you define them with the class keyword.  So we use the method const_set which adds a constant to the Settings module and sets it to our new settings Class.  Not too shabby: