Posts Tagged Programming

Jumping Into Local Development

May 7
Web

I realize that I am probably at least a few years behind the curve, but my office is finally switching from working directly on a development server to working locally and using git for version control. The last couple of weeks have been fun, and I am finally able to do some of the things that I have wanted to for a while. I thought I might share a few of things that have been most useful, mostly so my coworkers would have a place to find it all.

iTerm

I develop on a MacBook Pro and decided to use the iTerm terminal replacement program. It certainly isn’t necessary, but the biggest reason I like it is I can open split panes, new tabs, or new windows with ease. This lets me keep my commands and ssh sessions organized, which can be really helpful. You can use Cmd+d to open a new vertical tab,  or Cmd+Shift+d to open a horizontal one. The other feature I  have come to like is copy on select. Regardless of whether you use iTerm or the built in terminal, there are a few other things below you can do to make your command line life a little easier.

.bash_profile

Aliases

The first thing I did add some aliases. If you are not familiar with what an alias is or how they work, there are is a good article here.

The first thing I did was upgrade the “ls” command a little bit:

So all together the alias is: alias ls=’ls -GFh’

Sublime provides a fairly robust command line tool called ‘subl’ to make it easier to launch files in sublime, so make that a little shorter I created the following alias:

alias st=’/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl’

I also created some aliases to restart, stop and start my local servers. This saves time if you do something wrong that requires a server reboot. It will vary by your local setup, but for example this restarts my apache and Coldfusion servers:

alias serverrestart='sudo apachectl restart && /Applications/ColdFusion10/cfusion/bin/coldfusion restart'

Git Command Completion

Add this to your .bash_profile to enable git command completion on tab.
source /usr/local/git/contrib/completion/git-completion.bash

Display the git branch and commit status in the command Prompt

#include required libraries
source /usr/local/git/contrib/completion/git-prompt.sh
source /usr/local/git/contrib/completion/git-completion.bash

#enable the commit status
GIT_PS1_SHOWDIRTYSTATE=true
#Display the branch and status to the right of the working directory
export PS1='local: /\W\[\e[0;30m\]$(__git_ps1)\[\e[m\]]\$ '

Do you see the \[\e[0;30m\]? That’s how you see colors in the command prompt, it can be really useful, like setting your remote server to be red so you don’t accidentally delete files from the wrong server. You can learn more here and here.

Adding Some More Color

Git

Based on this excellent article, I added the following to my git config, which makes git color coded and easier to read:

[color]
ui = true
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan

Vim

Even if you don’t want to, you will probably end up in vim sooner or later, might as well make it pretty!

Sublime Text 2

After watching  Ben Alman live code at jQuery conference last year, I was very intrigued by sublime text. There are a lot of nice features, but so far I have enjoyed the command line integration and the extensibility the most.

Packages

The first thing to do is set up the excellent package control plug-in. After that, adding new plug-ins is as easy as hitting Cmd+Shift+P. The packages I have found useful, in no particular order:

*A quick note about Coldfusion code completion, it didn’t have camelCasing so I fixed that, you can learn more here.

Multiple Cursors

Snippets

I haven’t had a lot of time to plan with these, but I have found the clips2snippets library useful. It takes exported coda clips and translates them into snippets, although it does seem to be more then a little buggy.

SSH

Switching from the excellent  Coda2, one of the biggies I lost was not having the close terminal integration with the remote server, to fix that I have a few tips:

  1. Set up ssh keys to allow password-less logins
  2. Set up a ssh alias to your test server, that way you don’t have to type the long, and usually obscure, name every time.
  3. Update your remote .bash_profile to mimic your local one, nothing is more frustrating then typing an alias on your local machine only to have it yell at you.
  4. Set a color on the remote server’s command prompt so you always know where to go.

Well I think that’s about it for now, I’m sure as I continue to develop locally I will have more resources, so I will try to update the page as I go along.

Tags: , , , , , ,


Bootstrap Icon Search Update

Jan 29
Web

So my  site bootstrapicons.com has been up for a little while, and like all things, there have been some things that I have noticed that could be improved. I also have received some great feedback (Thank you!) that I wanted to incorporate into the system. So, I have been working really hard on it lately (okay so maybe “really hard” is relative, but I spent a few night drinking red wine and tinkering with it) and have a new release. Feel free to head over to http://bootstrapicons.com  and check out the changes.

Here is a little list of the new features:

Tags: , , , , ,


Introducing Bootstrap Icon Search

Jun 3
Web

I really love the bootstrap front-end framework, and one of my favorite things about it is that it comes with a great icon set. The biggest issue I have with it is that the class names to call those icons are not always either easy to remember or accurate for how I use them. For example, I like to use the icon-envelope as an icon on any systems that has a messaging system. Every time I have gone do use it however, I struggle to remember what the name of the  @%#$ icon class is!! It got to the point that I just kept a paper printout at my desk. That seemed like a bad way to do it, so I created a website that allows you so search the icons based on “tags” that are submitted by users. That way, I will be able to find my message icon, and hopefully, some other people will be able to as well. You can find the site at http://bootstrapicons.com – the more people that use it and submit tags, the better it will function, so please take a look and let me know what you think!

Tags: , , , ,


The more things change, the more they stay the same

Aug 7
Random

“The more things change, the more they stay the same.”
That’s one phrase I remember from college. I’m not sure where the phrase originates from, but I’m pretty sure I heard it from the head of the CIS program at GVSU, and professor for one of my final undergrad classes. At the time I thought it was a little strange to be coming from a technology professional, because we were inundated everyday with how once we get out in the “real world” if we didn’t keep updating our skills and staying on the cutting edge we would get left behind. As I go through the beginning of my career however, I am beginning to see the wisdom of that phrase.

Lately I have been reading a book called Blogging Heroes. A spur of the moment grab from the library, it interviews 30 of the top bloggers at the time about their experience and advice for blogging. The book is a little dated, published in 2007, but most of the bloggers they interviewed were still relevant, so I thought it would be a decent read. While it was interesting, what I found most intriguing was their perspectives on blogs. Most started their blogs in the early adapter stage of blogging, and talk about how they didn’t know where blogs were going. What was so interesting to me is that if I changed the word blog into social media, Facebook, or Twitter it looks remarkably similar to many articles I read today. Will ____ survive the test of time? Does ____ really add business value? Are ____ too personal and biased to be considered journalism? Across a period of four years and a ton of technological advances, the same questions are being asked now. Today, blogs are mostly taken for granted as a good idea that will be around for a long time, now it is social media that is being questioned.

As I look at other aspects of technology, the phrase rings true as well. Printers today are wireless, vibrantly colored, direct-from-camera enabled, and yet, I spend as much time un-jamming and power cycling them as ever. Today I program mostly in coldfusion, jquery, php, and asp.net, but the concepts I first learned in basic HTML and Java still hold true and influence how I code. Despite how connected and networked our everyday lives have become, the go to utility to test a connection (ping) has been around since at least the early 80’s, probably before I was even born.

It seems, especially concerning technology, the more things change, the more they stay the same.

Tags: ,


SimplePie – Easy PHP RSS

Mar 15
Web

SimplePie RSS LogoI write for this and two other blogs, and I like the homepage of my personal portfolio (www.brentswisher.com) have up to date information about all of my posts.  It makes for an easy one-stop-shop of all of my online activity, and I like the idea of having a dashboard of my recent activity as a home page. The issue is that manually updating the page each time I create a new post would be a bit tedious.  Since all my blogs have built in RSS Feeds, I though that would be a great way to embed new posts.

These were the criteria I was looking for:

After a little searching, I found something that works great: SimplePie RSS

SimplePie is a PHP based RSS parser.  It’s a PHP class that allows you to access RSS feeds in a object oriented way.  It is really simple to customize as you specify which parts of the feed to display, and you can insert them using standard PHP code anywhere in your site that you need.  It’s fast, easy to learn, well documented, and I would recommend it for anyone looking to use RSS in their website.

Advantages:

Tips:

I would definitely recommend SimplePie for a RSS parser, what about you? Let me know if you have another solution you enjoy!

Tags: , , ,