Xcode – Code Snippets… It’s about (saving) time.

In programming, you will inevitably need to use the same functions in different projects. Maybe you have a super-cool sorting algorithm or are just tired of typing out the same stuff for a pickerView.

Enter Code Snippets

In short:

  • Type out some code you use all the time
  • Select it
  • Right click and click on “Create Code Snippet”
  • Add in some details like a name and summary
  • Click Done

Now, if you need to add in this code to your project, just hit the little plus button in the top right of Xcode (or Shift + Command + L) and drag your code in from the snippets tab.

It’s fast and efficient.

For more, go to: https://sarunw.com/posts/how-to-create-code-snippets-in-xcode/ which explains snippets in awesome detail.

Down The Rabbit Hole with the Back-Tick

I made a MySQL query a few days ago and came across a problem to be mindful of.

Or so I thought.

phpMyAdmin is a really great tool for learning MySQL queries. Often, when you click on something, phpMyAdmin will reveal the SQL query that was made to get the result you were looking for. A simple Copy/Paste, maybe a quick modification to meet your needs, and you’re on your way.

I copied. I pasted. I got a whole lot of errors.

Then I removed the back-tick, saved, and refreshed. And, Viola! Success!


But, I did some research and found that MySQL doesn’t care if the back-tick is there or not (at least in the way I’m using it). So I tried putting them back in and it still worked. I’m not 100% sure why. My best guess is I did a Save-All instead of just a Save. This may have saved the file that contained the fix to my code that just hadn’t been saved yet.

So, I did some research, and After finding this: https://www.quora.com/What-is-the-the-character-under-the-tilde-called-and-how-can-it-be-used-in-PHP-programing?share=1 I began to learn something more concrete than “It worked last time like this.”

This was one of those problems where you learn a lot. You start to peel back the layers and learn what a seemingly insignificant character is capable of.

I learned it’s possible to run system commands from PHP. I had no idea. But, I’m glad I found it because it’s provided me with a possible solution for an idea I’ve had for awhile.

That’s how it works. One piece of information at a time. Sometimes, something new shows up in an unexpected place. Because of this, I believe it’s worth looking past a simple copy/paste solution and getting a better, more thorough understanding of the problem.

Hello world! – No, really, Hi!

It’s where it all starts for anyone learning to code. We start with the very basics and build our skillsets one piece at a time.

As I add those pieces I’ll post about them here. Maybe I’ll find it helpful later on to look back on my failures and successes. Maybe it’ll help someone else.

If it helps you, if you have a question about something I’ve written, or you just want to chat for a bit, leave a comment or email me or something. I look forward to hearing from you.