Colors from Hex in Objective-C

Apr 20

EDIT 5/4/12: real men can admit it when they’re wrong— I’ve retooled my approach to use a category on UIColor, hopefully making it easier to use.

I want to tell all you iOS devs about the minorly fantastic thing I’ve created. Here’s you:

First World Problems“…Y’know, I wish I didn’t have to ALWAYS create colors in my app using an RGB float value. Why can’t I just use hex values? Apple put methods into Objective-C for nearly everything, didn’t they think this one would be a common use case? Also, I don’t like the way I maintain the colors in my app, but I don’t have a real knockout solution. Globals are lame, I don’t want to define the colors in my header, and I DEFINITELY don’t want to maintain a dozen points where I change the screen background to a certain shade of red. Dan, what should I do???”

  

Internet Superhero

Fear not, fine citizen… I’m here to help.

I’ve made this here color factory that allows one to  create UIColor objects from hex! It doesn’t mind playing rough: 0Xffcc54, #F00BA4, 345667… it doesn’t care, they all work. It creates the colors from a class level method, you don’t even need to instantiate my stupid factory to use it!!! Seriously, it’s a very simple singleton factory— you’re gonna love it.

  

Here’s how to use it to generate a color somewhere in your app:

Easy right? So that’s how I initially dreamed it up, but I soon found that it became cumbersome to create colors a billion times. I needed some way to access global colors, but many ways of doing that are cumbersome and gross. Here’s what I came up with: I made a singleton object that instantiates a bunch of user defined colors and holds onto them for use across your entire app. This object gets created the first time you call it and just goes wherever you tell it.

  

Tacolicious

I love tacos, can we talk about them for a minute?

Let’s say for the sake of argument that you have a UIViewController in your app called TacoViewController. This view is responsible for displaying a collection of UIImageViews representing a taco in some view controller, but you aren’t exactly sure which shade of brown you should display for the carne asada. 

  

    

Here’s how you use Color Factory to make your job easier:

Bring Color Factory into your project.An easy way to do that would be cloning my repository HERE and drag ColorFactory.h and ColorFactory.m into your project in Xcode.You’ll notice I’ve loaded a sample scheme in, you can delete that nonsense— it’s just there to show you the way.

Here’s what your ColorFactory.h should resemble:

And then in your .m, initialize your colors in your shared factory like so:

You’ve got your color palette created now, let’s learn how to use it.

here’s SomeViewController.h, where we have 4 UIImageView objects representing the various layers of a taco and a ColorFactory object for our palette:

Finally, we come to the implementation of SomeViewController

…where we initialize our color palette to the shared ColorFactory resource. We then use these colors to fill our taco images with the right colors. Check it out:

I don’t have any taco apps on the market right now, and I don’t think I would create a taco from a collection of UIImageViews but this hopefully gets my point across. We use this class here at Attachments.me for our iPhone app, it really helps to keep text, table cells, backgrounds and so on all cohesive with a singular design. To create the colors, I modified a method written in one of WrightsCS’s posts on stackoverflow. I’m pretty sure this method of singleton creation is thread safe as well.

Sukoshi

Questions/comments/solutions/complaints/quandaries/dilemmas?

  

Once again, the git repo is located here ->Color Factory Repository    

  

—Dan (@DanReedx86)

  
BONUS: People like cats in the internet, here’s a photo of one of mine. This is Sukoshi, he’s a gemini from the Detroit area and he loves to eat cat food, pea pods, and spiders. Hobbies include being afraid of everything, chasing bugs, and laying in the sun.


Attachments.me and the Wappwolf Automator

Apr 12

By now you know the drill. Here at Attachments.me we try to keep busy work to a minimum. We are always looking for ways to save you time. This is why we have decided to team up with the Wappwolf Automator. With just a few examples of how this new connection works you will easily see how it can increase your productivity and maybe even allow you to get out of GMail and do something fun.

Convert to PDF

Keep it simple. Are you annoyed at getting some weird, bizarro format as an attachment that you wish was a PDF so you could read it on your phone? You’re not alone. Thankfully, the Wappwolf Automator has you covered. All you have to do is send those attachments to Dropbox with Attachments.me where a nice little Wappwolf folder will instantly convert those bizarro docs to PDF. Just set up the function with the Wappwolf Automator and you’re done. Easy, right?

Tricks for Pics

Getting Gmail with pictures from your family and friends is always nice, but it can be a nightmare sorting them all out so that they’re presentable for all of your social media outlets. With Attachments.me you can easily store them to your Dropbox through the automatic filing rule where you can let the Wappwolf Automator do its thing. It will resize, edit and organize your pics so you can post them at will.

Save GMail attachments to Evernote

Accessing notes is not restricted to carrying around your notepad anymore. With Attachments.me you can send your attachments straight to Dropbox where the Wappwolf Automator will organize them and send them to your Evernote account. From there you can access and edit your notes from pretty much anywhere. No notepad or pen required.

It doesn’t end there. You can send files to your Amazon Kindle, zip files and even upload photos to Facebook, Google+, or Flickr, all from your GMail.

For an easy way to end needless headaches, you can find step-by-step instructions to link up Attachments.me and Wappwolf right here


Hiring Hipster Software Developers, a Practical Guide

Apr 1


Attachments.me is based in the Mission District of San Francisco. In terms of hipsterism, according to a 2010 national survey, the Mission falls between Portland Oregon and Los Angeles. As a result, building a work environment attractive to today’s Macbook-wielding, tech-savvy hipster is integral to our hiring strategy.

Hipster Index

The aptly named startup Hipster famously offered a year’s supply of PBR, as incentive for would be employees. This gesture might have worked in 2011, but with today’s level of competition, more is needed. Creating a hipster-friendly work environment is our utmost priority. I’d like to share some of the steps we’ve taken to achieve this, in hopes that it can benefit other companies striving to do the same.

1. Programming Language Selection is Key

There are three varieties of hipster software developers:

Purists:  Purists believe that software development should be reduced to its simplest, most mathematically sound, rudiments. Common Lisp is an example of a purist programming language.

The Sardonic: The steam-punks of the programming world, they thrive on using programming languages that have fallen out of mainstream appeal. Examples of which include: Turbo Pascal, and Logo (which powers Instagram).

Obscurist: The obscurist is only happy when they’re using programming languages that are on the cutting edge. Node.js is an example of a technology that would have fallen into this category, but frankly it’s getting a bit mainstream now.

As a startup focused on hiring hipsters, it can be difficult to bridge the gap between these three divergent demographics.

At least it was before the advent of Clojure. Clojure combines the appeal of an obscure technology, the purity of Lisp, and the anachronism of Java. Making it the perfect choice for your startup.

Stephen

2. Think about Making a Barista One of Your Early Hires

For a bootstrapping startup, heads down in the hurly-burly of the software development cycle, a barista might seem like an indulgent hire. Let me tell you, our barista’s name is Stephen, and we don’t regret hiring him for a second. The amount of productivity wasted, wandering to the nearest cafe that serves Blue Bottle Coffee, can be staggering. Furthermore, on days when the expresso is pulling poorly, developers can spiral into a negative mood that further impedes velocity. Hiring an award winning barista can help solve both of these problems. It also provides a workplace perk that your hipster developers will find hard to resist.

Glasses3. Choose a Medical Plan that Fits Your Employees

A good medical plan is the keystone to a good work environment. Part of choosing a good medical plan is choosing one that fits your employee demographic. It took us a long time to settle on Fixed Care™ as our health insurance provider, and it was far from the cheapest. Having said that, it provided unique benefits including: coverage for up to four hours of tattoo sessions, per-annum; and $200 worth of eyeglass coverage, regardless of one’s need for prescription.

4. Introduce a Progressive 20% Time

Google is known for introducing the concept of 20% time. Allowing employees to spend one day a week on projects that interest them. We love this concept, and make an effort to avoid putting any restraints on how our employees spend this time. Here’s what some of employees have to say about it:

Art BikeJesse: “I love my 20% time, I’ve been spending it building a really sick art bike for next year’s Burning Man.”

Mike: “The mix tapes I’ve been working on have become a huge creative outlet for me. It’s amazing to work somewhere that encourages it.”

Dan: “I think that 20% time used to be way cooler. Every company is doing it now.”

I hope you’ve found these tips useful. I’d love to hear your own hipster hiring strategies, please comment below.

— Ben (@benjamincoe)


Facebook Integration

Mar 30

We’re working hard to take away all the busy work that comes along with email attachments. Automatic filing and integration with Dropbox and Box was a big step.

Photos are one of the most common attachments that our users receive. What if you want to post these directly to Facebook? You need to download all the photos, open up Facebook, create an album, and then upload those photos. What a hassle! we’re fixing that.

Upload Photo Attachments Directly To Facebook

Now from our Chrome extension, you can upload your photo attachments directly into Facebook. It’s easy.

Start by selecting some photos:

Now click ‘Save to’. You’ll see there is now a Facebook service available in the folder selector. The first time you use it you will need to link your account:

Once it’s linked, you’ll get to choose a photo album:

Once you click ‘Save’, the photo(s) you’ve selected are sent to Facebook. Easy as that.

We hope you find this useful and it saves you a bit of time. We’d love to hear what you think!


Music To Code By

Mar 15

A long time ago, on a peninsula not so far away…

Your dad's MP3 files

     Our whole crew here at Attachments.me are above all committed to making inboxes around the globe easier to use, but we also share another common bond: music. We’ve all got music in our blood: listening to it daily while coding, each of us play at least one instrument, and we have a shared eclectic sense of ‘what’s good to listen to’. Jesse has toured as a DJ, Mike contemplated becoming a concert pianist when he was younger, and Ben and I (Dan) both like to dream of being rock stars one day. With these sorts of backgrounds, there’s tons of music flying around the office. We tend to share, and *crosses fingers* maybe one day we can start up an office band. I’ll grow my hair long and invest in a hair spray company; we’ll make millions thousands dozens of dollars. On second thought, maybe it should be more of a backup plan. This email gig seems to be working out for us, perhaps I’ll just share what we’re into and leave it at that. Best case scenario we can help you become more productive at work or when trying to code, worst case maybe you just find a few new bands you can enjoy and impress your hipster friends with.

  

So whatcha listening to?

You might recognize this guy...

     Personally, I’ve got a varied taste in music mostly focused around metal and punk. Here’s a link to my last.fm profile. I love last.fm’s scrobbling feature, I scrobble from wherever I can. It’s been skewed by my days of coding, but you might be able to discern my favorite flavor of music (hint: aggressive, violent, and often angry). I like bands with smart lyrics like Bad Religion, “everything louder than everything else” like Motorhead, and searing emotion like Pantera. Here’s the thing though: NOFX isn’t a very productive band to listen to while coding— at least in my own personal experience. The words and the emotions get into me, distracting me and keeping me from achieving any sort of flow. I’ve learned to stray away from my usual taste when I’m trying to engineer software. The music I code to isn’t anything like the music I listen to when walking home from work. I take comfort in the sound of a 56k modem and a wave synth, tending to spend my workdays listening to dubstep and chiptunes softly banging my head to heavy wubs and thumping square waves.

  

Yeah… but you’re just some dude.

Pictured: a strange bird     I know what I like, but I also know that coders are often a strange bird (pictured right). When thinking about the layout of this article I wanted to be careful not to alienate people. I’d be crushed if I wrote this post for everyone and I got downvoted to H-E-(hockey sticks)*2. Thus I went to some of our friends with some questions. Attachments.me is based in Dolores Labs, a shared workspace where a half dozen odd other companies (Card.io, colingo, Statwing, Wishery, Happiness Engines, among others) work together and swap ideas. It’s a very nice place, I wholeheartedly recommend trying to get in here. I digress, back to my article— I sent everyone here an email asking what they like to listen to/why and got back a ton of responses. It appears as a whole, the coding community around us concurs.

When coding, one should seek a few criteria:

  • Faster pace
  • Repetitive
  • little/no words (or in a language you don’t understand)

  

  

O rly? Ya rly.

    (Alert sound from MGS) Fast paced, repetitive, with little or no words? That leaves two choices for optimum accuracy: classical and electronica. Both supergenres hold a wide variety of wildly different styles, there’s something for everyone’s varied taste. Electronica can be split into trance, house, minimalist, dance, dubstep, chiptunes, chipstep, drum n’ bass… the list goes on for days and days. Classical is just as varied. If you’re an aural sponge soaking up soundbytes (like me), I’ve made a few spotify playlists you might enjoy. Here’s one for Classical, Contemporary (mostly electronica with a few other jams), and both. This is a collection of everything I listen to as a coder, plus many recommendations by friends and colleagues. It follows the 3 cardinal rules, has varied tempos and styles… both lists are pretty good. Not that I’m biased or anything, it’s not like I created it. XD

    

  

What’s next? I’m sick of everything I have…    

I'm taller in person...

     Having a huge list of songs is great, but eventually I always run out of enthusiasm for what I’m currently listening to. I need something new, hearing the same thing day in day out gets boring. I don’t listen to the radio very often (although the radio in SF beats the radio in Detroit hands down) and I don’t go to places where people are listening to music in a crowd setting. Where is one supposed to go when searching for new music? I’m here to help, and I have the internet! Many have come before me with the intent of assuaging your lust for new music. Let me introduce you to a few of my favorite services on the web for finding new music. I have no doubt I’m missing your favorite service, feel free to plug it in the comments. I love finding new things and new friends.

  

The Short List

     Most of you have already heard of it, but pandora is a great service. You type in something you like and it creates a radio station full of music that their mighty computer brain thinks you might like.

     With Turntable.fm one joins a room full of likeminded people and the crowd votes on who gets to DJ. the DJ picks a song and if they betray the trust of the crowd the mob can mutiny and instill a new ‘el hefe’. Truthfully, Mike uses this one more than I but the limited experiences I’ve had with it have been positive.

     One of the guys in Dolores labs recommends Hype Machine, an aggregator that grabs music from blogs and lets you listen to whatever you fancy. I’d recommend it highly to those who want to experiment. A veritable cornucopia of genres here, I wouldn’t use it while I’m coding but definitely in my spare time.

     SoundCloud is another fantastic source. Not only is it good for audiophiles, it’s also good for burgeoning artists. Anyone can add music, users can leave comments on tunes they like (or dislike), and the library seems nearly infinite. I really like soundcloud. If you look hard enough, you might even be able to find a few tracks by yours truly.

     My absolute favorite: spotify. Even the (slightly) limited free account I have no problems aggregating 95% of all the music I’ve ever had. Once in awhile they won’t have something I’m looking for… but those times are very rare. I can make playlists of whatever I want, listen to my local library, it scrobbles to my last.fm profile… spotify is fantastic. I didn’t like this feature at first, but I’m starting to like how it posts to my Facebook after the addition of timeline. It’s not so spammy anymore, but it definitely shows everyone I know what I’ve been listening to and I think that’s just neato.

  

So long and thanks for all the fish!

I love you internets.     That’s my toolbox of music tools, my philosophy as a coder, and my life’s blood in a nutshell. Take it; go forth my brethren and listen to the feast for your ears laid out in front of you. We live in a fantastic time for music. More artists than ever have the tools available to create wonderful things. The intertubes make it easy for you and I to find that music and share it with our friends. There’s a lot of colors in the sound rainbow, try and pick up a few more for the palette of your life. (NON SEQUITUR ALERT)I love my job.

    Did I miss anything? D’you disagree? Live in the bay area and want to jam (I sold my guitars, piano, drums etc when I moved to SF so you’ll need an extra) or talk about music/code/cats? Leave a comment below, or send me some mail.

—Dan (dan@attachments.me) 

tl;dr: If you’re a coder, you might enjoy these music playlists for Classical, Contemporary, and both.


My First Six-Months as a Developer in San Francisco

Mar 7

I grew up in Fergus, a village of ten-thousand people in rural Ontario. From a young age, I was a computer geek. My father was a technologist at the University of Waterloo and, as a hobby, we’d assemble personal computers out of whatever parts we could scrounge.

It was at the age of thirteen that my hobby became a passion. Two things happened: I discovered the Internet, and started building my first website on GeoCities; secondly, I stumbled across someone programming in a computer lab.

I immediately fell in love with hacking. The process was so creative; with the right lines of code, I could make a game, or a chat program, or googly eyes that follow your cursor around (you should have seen my website, it was epic).

I breezed through the courses that school had to offer, hungry to learn the craft. The final course that Centre Wellington District High School offered was project oriented. At the start of the year we were split into groups. Each group was to come up with a project idea, present it to the teacher, and execute on it as a team. There were three such projects throughout the the semester. It was a wonderful experience working in this collaborative environment. I fondly remember my peers, and the software we created.

Rather than just hacking on code, this class got me thinking about the software development process itself. A dream started to take shape; I wanted to work with a bunch of talented, creative, friends, where I would have the freedom to build, world-changing computer software.

There was not a huge startup scene in Fergus. A foreigner dreaming of a land of opportunity, my dream evolved; “I want to move to San Francisco and work at a passionate, creative, startup!”

It’s a long journey from a teenager in rural Ontario, to a twenty-something software developer in San Francisco. Six months ago, with nothing but my skinny jeans, a naive optimism, and Attachments.me, I made the move.

How does San Francisco compare to the dreams of a fourteen-year-old nerd?

It’s A City That Encourages Ideas

San Francisco is an environment where ideas are encouraged, even crazy ones. I like this. Before Attachments.me, I worked in Toronto. As part of its quest to be New York junior, Toronto prides itself on its pragmatism. I remember scoffing at wacky ideas. “Social websites with no immediate monetization strategy, bubble!”, I’d yell, while adding new summation features to the accounting software I was working on.

I bet a lot of buildings fell down in Florence Italy during the Renaissance. It also produced marvels such as the Dome of the Basilica. In turn, a lot of startups in Silicon Valley fail. It has also produced: Google, Facebook, Apple, Twitter, and many other revolutionary companies. In an environment less open to crazy ideas, I think this innovation would not have happened.

It’s A Talented City

Developers the world over know that San Francisco is the centre of their industry. The result is an influx of a high-class of passionate talent. People who care enough about their field to make a life-changing move. Add to this that companies throughout the valley are constantly searching for undiscovered talent to import. The end result? San Francisco is a damn talented city. Are you used to being a big fish in your local developer scene? Chances are you won’t be a big fish here, but you’ll be amongst talented peers who help push you to new heights. Speaking of which…

It’s A Friendly And Collaborative City

I love climbing. When I landed in San Francisco, one of the first things I did was hunt down the local climbing gym. In my two years of climbing in Toronto, I didn’t really make any friends at the gym. At Mission Cliffs in San Francisco, I have met at least ten people who I consider friends. All of whom happen to be developers, everyone is here! My climbing buddies work for Github, Engine Yard, Dell, LinkedIn, Quantcast, and Greplin, amongst other companies.

A typical trip to the gym consists not just of climbing, but of collaboration on the current problems we’re facing at work. How has a much larger company, like Github or Quantcast, dealt with their scaling problems? I can put these questions forward to my peers while working on a sick V7, or over post-climbing beers. You find this kind of friendly collaborative discussion everywhere in the city.

How Does it Compare to the Dream?

I love San Francisco. I do not, for a second, regret moving my company here. It is an environment close to an idealistic nerdy kid’s imagination, that’s a high bar to hit.

Don’t I feel guilty about contributing to Canada’s brain-drain? I’m not particularly nationalistic, but I do care a lot about my industry. Florence Italy during the Renaissance demonstrated the immense value of shoving a bunch of talented freethinkers into a small area. It creates an environment of collaboration where truly great things can happen. San Francisco fosters this environment.

If you’re a developer reading this anywhere other than San Francisco, here’s my advice: Stand up; quietly sneak out of your cubical; buy a plane ticket; and come work here, preferably at Attachments.me.

— Ben (@benjamincoe).


Automatic Filing, New iPhone App and Box Integration

Feb 20

We’ve been hard at work and have a lot of exciting stuff to announce today.

Automatic Filing

Email causes so much busy work. Almost every email you receive becomes a todo item. For example, every time I receive a receipt from GitHub, I download it to a folder in Dropbox called receipts which is shared with my accountant. When I receive a ticket from TicketFly, I put it in another folder called tickets. This sort of busy work eats up your time when you should be doing more important stuff.

Enter automatic filing.

Automatic filing allows you to setup rules which specify how your attachments should be sorted into your cloud-storage solutions. The rules let you filter on the sender of the email, as well as the file type. So I could setup all Images from Ben to go to a folder called RidiculousPhotos. Or I can be more broad, and setup all Documents from Mike to go to a folder called MikesDocuments. If I really want to get crazy, I can even setup all the attachments I receive to go into a folder called MyAttachments.

We are super excited about automatic filing, as we really feel it can help people get more organized, and ultimately take back some of their time. We have a ton more options we are going to add to automatic filing rules but, as always, we’d love to hear your ideas too. Currently you can only set these up in the Chrome Extension, but you will eventually be able to set them up from our site or from the iPhone application.

New iPhone App Version

Speaking of our iPhone application, we just released a new one! It has a really great new feature. You have all of your files “in the cloud”, available everywhere, right? With Gmail, your email is also “in the cloud”. So why is it that the only way for you to email a file to someone, while on the run, is to send it via a link?

Enter cloud attached files.

Now, from your Attachments.me iPhone application, you can compose an email and attach files to it from cloud-storage like Dropbox, or from your attachments in Gmail. When you click send, the file never gets downloaded to your phone, but instead we send it from the cloud, with the real file attached. This makes it super fast and saves your data plan!

Box Integration

We are very happy to announce that our cloud storage integration, which formally only supported Dropbox, is now also available for Box! Whether it’s from your Gmail inbox, or on our iPhone application, attaching from, and saving to Box has never been easier.

Ben put together a great new video that show cases some of these new features. Check it out below!

Jesse


Gmail and Dropbox Together at Last

Dec 14

The most important part of building a startup is zeroing in on what it is that you do well.

Attachments.me started out as a search service, solving a very real problem that people have in their email, finding their old attachments.

We’re excited about our search offering, but feel that it alone does not make our killer-app. We’ve spent a lot of time at Attachments.me thinking about how we can take things further and build a product that makes email truly better.

Our Chrome Extension was a big step forward, it allowed us to introduce our functionality directly into the Gmail workflow. Since this release, I feel we have been homing in more and more on what it is we do well.

“Attachments.me is the glue that can pull together disjointed cloud-based-services into a killer document management platform.”

For starters, we seamlessly combine the Dropbox and Gmail experience, allowing you to:

  • search for attachments directly within Gmail.
  • upload the attachments directly to Dropbox.
  • embed Dropbox files when composing an email.

I’m really excited about our current direction, we have some slick features planned. It was just a matter of figuring out what we do really well.

Get the Chrome Extension

— Ben (@benjamincoe).


Attachments.me is Officially Launching with Dropbox and More…

Nov 30

We are happy to announce that we are officially removing the cloak of beta. At the same time, we are rolling out a couple of new features that we’re really excited about:

Dropbox Integration

Upload to Dropbox

Our Chrome extension now features integration with Dropbox. Upload attachments directly into a folder on Dropbox without ever leaving your email workflow. 

Email Hooks

Along with Dropbox we have released the first of what we are calling Email Hooks. When you first send an attachment into a Dropbox folder, you will get an email from us giving you a custom address that is connected to your Dropbox folder.

Email on phone

You can now email to that address and any attachments in the email will be uploaded right into your Dropbox folder. These email hooks are part of our ‘Email as a Service’ philosophy. Using a similar approach, we plan to add many more useful hooks to your email.

We hope you like the new features and as always, reach out to us with any suggestions or questions.

The Attachments.me Team


Advanced Gmail Search Operators

Oct 31

Getting to know Gmail’s advanced search operators can make you that much more productive when searching through your email. You can use any of the following operators right in the search bar and these ones work really well with our Gmail extensions.

to:

The to: operator allows you to search through your ‘Sent Mail’ for email you sent to someone. After you’ve typed ‘to:’ and then start typing in an email or contact name, Gmail will start suggesting contacts for you.

Example:

to:somebody@example.com

Shows you all of the emails you sent to somebody@example.com

from:

The from: operator is just like to: except that it allows you to search for emails you have received from a particular contact. Note that you can combine either from: or to: with other keywords to further refine your search. 

Example:

from:somebody@example.com resume

Shows you all of the emails you received from somebody@example.com that have the word resume in it

filename:

Filename is a powerful operator which lets you search by both the filename or the extension.

Example:

filename:pdf

Shows you all of the emails that contain a pdf attachment


Page 1 of 3