SBSwiftRevealView now on Github!

September 30, 2014
Reading Time: 1 minute

Being swamped with work and other personal projects has left little time for me to get this awesome reveal view pushed out to github. It’s in the beginning stages of implementation, but contains at least the minimum number of features to get it up and running in your current or next iOS project, the best part being that it’s all written in swift 🙂

To access the repository click the link below:

https://github.com/SBero/SBSwiftRevealView

 

epub/pdf to ipad.

August 19, 2014
Reading Time: 1 minute

I’ve been running OSX Yosemite since the first beta was released months ago. Typically for me to upload PDF files to my iPad, I would just connect the device, open it up in iTunes and just drag and drop onto my iPad. This appears to not work at all now for transferring epub/pdf to iPad.

I ended up finding out that you need to add the epub/pdf files to iBooks. But there’s a caveat.

If you have iTunes open, hoping to transfer the books to your device you won’t see them. You need to completely close iTunes and go back to the device’s ‘books’ section. You should now be able to click ‘Sync Books’ and choose your desired option of either sync’ing the entire library or just selected ones from the section below that (which should show the books you have available in iBooks).

Hope this helps. It was sure frustrating to me.

AngularJS Cannot read property ‘1’ of null error.

August 16, 2014
Reading Time: 1 minute

tl;dr Check your views for any empty directive tags, such as ng-controller=””.

When you’ve been using AngularJS long enough, you quickly realize that some of the error messages can be pretty cryptic. This one is no substitute:

Cannot read property '1' of null

Some of these errors will send you into an instant mental panic, thinking…what.did.i.just.do?!

I’m not sure of all of the cases that this error will appear, but for me it was because I left an ng-controller=”” empty in the html view. So if you get this error begin looking for any empty directives tags in your view(s).

Google Chrome Extension

July 22, 2014
Reading Time: 1 minute

So I was tired of constantly checking my other computer which I mainly use for downloading, so I made this very lightweight Google Chrome extension called ‘Download Notify’. It gives you a single beep on completion of one download, and when all downloads are complete you get a final completed sound.

Check it out here: https://chrome.google.com/webstore/detail/download-notify/nieieojodgghoomakdkpkeipnncmbhdo?hl=en-US

Swift Snippet – Output all fonts to log

Reading Time: 1 minute

I was working on an app refresh in Swift the last few weeks, and wanted to get an output of all the fonts available to me. However, I decided to just write a quick Swift function to do just this:

Updated for Beta 5.
Enjoy!

Circular References in AngularJS

July 1, 2014
Reading Time: 1 minute

I just encountered this for the first time yesterday, and was absolutely perplexed by it. So much so, that I completely reversed my commit to walk through it to try and figure it out.

Even though I’ve now found that including one of my services in another service is creating this problem, I did stumble upon this resource from Misko Hevery. Very well done indeed for helping you figure this problem out: http://misko.hevery.com/2008/08/01/circular-dependency-in-constructors-and-dependency-injection/

Just released a new game update to realize I need another update

June 11, 2014
Reading Time: 1 minute

So I recently updated another game that I had released about 2 weeks ago (Connect The Dots) and just pushed out an update for it that was approved. I didn’t however, realize that I had selected iOS 7.1 (or Yosemite did something on me :/ ). I’m currently working on finishing up the multiplayer with Game Center for the game by this weekend to re-release it under 7.0.

I’ll post from my Twitter account once I have it submitted to Apple.

If there are any features and/or game concepts that anyone would like to see implemented in either of the two games, please let me know, and I can see about making it for a future release.

Creating Your Own Custom Directive Library – In Isolation

May 20, 2014
Reading Time: 2 minutes

I’ve had to come up with a better strategy recently for making custom directives that didn’t involve make subtle changes in the browser, save file, refresh, go to said feature, check it. Mess with things in Chrome Dev Tools. See what it does, etc. That sucked.

So, I did what anyone with a problem does. Try and solve it. I knew that some of the custom directives I needed would require certain server api data (list of customers, customer detail, etc.), so that had to be figured out, but then I still needed an isolated way that was also very organized for making custom directives. From this, I stumbled upon one of my favorite time savers.

Custom Directive Library In Isolation

1) Open Google Chrome.
2) Go to the Chrome Developer Tools and click on Network.
3) Navigate to the page you need data from or use an extension to make the API call.
4) Locate the API call in the Network activity list.
5) Right click the call and select Copy Response.

You now have a server replica of the exact data and format that would come from the server to mess with, in the next steps. I take this and assign it to a JavaScript variable and can forget about having to always have memorized the data format coming from the server.

Next you need an online all-in-one editor. There are many out there, I happen to prefer Plunker (http://plnkr.co/) because it has version control built-in, it makes it super easy to add whatever libraries and frameworks you need. You could make a default template for your project and just fork it every time you need to start a new custom directive, giving you the perfect boilerplate code to jump right into the actual coding and not start off with having to do the same boring setup routine every single time.

Before you know it, you’ll have around 10-20 custom directives for use either in a single project or multiple. Customizing a single directive for a different project is extremely simple with forking, but best of all, it saves all of your directives in a single, sharable (and hopefully organized) repository.

I’ve found that with this technique, I’ve cut my custom directive development time by 40-60% depending on where I’m creating it in the application (inside of a page, after you login and click on item ABC, to find a feature in the modal popup…. :/) and probably increasing my custom directive development enjoyment by as much, if not more.

Hopefully this tip helps you as much it has helped me.

Finally completed an iOS Sprite Kit game

April 28, 2014
Reading Time: 1 minute

Things have been quiet around here for the past few weeks, well I guess only on the site. I however have been busier than can be between work and doing some of my own side projects. One of those happens to be an iOS Sprite Kit game that I created. I find that when doing an inital use for a given framework, it’s best to do simple individual iterations of different concepts that you’d like to try out, see how those work together, before moving forward with a much larger idea. So that’s exactly what I did.

This first app is a timed version of tic tac toe. It introduced some initial game making concepts that I got to understand, and then create a solution for (nothing earth shattering, but going just from concept to production is a learning experience in itself). It introduced setting, saving and re-initializing timers among other things as well.

I pushed it out to the app store, where v1.0 currently sits. You can check it out here.

I’ve already started brain storming the next app idea, which I’m torn between doing another one in iOS Sprite Kit or Cocos2D-X. I’ll probably at least do a longer, more adventure based game in iOS Sprite Kit at least one more time, before pursuing a different iOS framework. Eventually I’ll make it into porting at least the Timed Tic-Tac-Toe game to Android as an exercise.

Happy Coding!

My Preferred AngularJS System Structure (Repo Inside)

March 5, 2014
Reading Time: 2 minutes

Having used AngularJS for some time now, I must admit that I really prefer a combination of different folder schemas for the project. I’ve created a github project for my schema at https://github.com/SBero/angularjs-start-repo

After stumbling upon John Papa’s Hot Towel Angular (and not really being a big .NET guy myself) I preferred to change things up. I took his layout and some of his front end enhancements, and combined them with the angular-seed-repo on github, changed up the theme to more of my liking for a build to start with on my projects.

In general, this allows me to start my projects with an excellent starting point and get right into building the core application. I’ll get around to pushing out an IE8+ compatible seed as well. You can go follow the angular-seed-repo guidelines for starting up the node.js server and to serve up a local server to the front end. There is also all of the testing integration from the angular-seed-repo so that you can have your end-to-end tests.

I would eventually like to integrate the following:

  • BreezeJS – dynamic updating with a server. brilliant.
  • Chart.js – amazing charting library. very cool.
  • Animate.css – some pre-defined library of animations.
  • Formula.js – do formulas in the browser 🙂
  • Bootbox.js – makes bootstraps modal windows easier to use.
  • Chardin.js – simple, yet beautiful overlays with instructions.
  • SimplePagination.js – great javascript pagination library.
  • Echo.js – lazy loading of images. a must.

Having all of this working in a base app will make doing nearly any online web application project feasible without having to put this all together and lose 2-3 days of time in the process. Just determine which libraries you actually need, remove the ones you don’t need from the index.html file, as well as any associated files, and your good to go. Obviously some of them are required, however, those will be marked.