Git Copy a File From Another Branch
Just saved me about an hour’s worth of work:
$ git checkout branch file
Notes on UX design and web development from some guy doing both
Just saved me about an hour’s worth of work:
$ git checkout branch file
If you work on multiple Git branches throughout your workday, you probably find yourslef constantly git branch‘ing more than you’d like.
Instead, why not add your current Git branch to your command prompt?
Just add this to your ~/.bashrc file:
That creates a command prompt that looks like this:
jeff@lookitdev Resources dev-MEM59 :
That’s your username at your current hostname, your current folder, and your current Git branch.
We’re getting closer to finishing the Lookit iOS app using Appcelerator Titanium. The app calls a custom API on the Lookit server for both submitting pictures to the server and getting pictures, ratings, comments and other data about everyone else’s pics.
The user experience of our app is as important to me as getting the app to work correctly in the first place, and that includes making sure the app is responsive and usable on slow cell connections. Of our iOS beta testers, more than 80% of them have installed the app on an iPhone or iPad with 3G service.
Since most of our development happens in the iOS simulator on laptops with great wifi connections, we needed a way to slow down our internet connection to simulate a cellular connection.
You can limit the network traffic on your Mac to 3G-like speeds with three lines in the Terminal:
$ sudo ipfw pipe 1 config bw 30Kbit/s delay 350ms $ sudo ipfw add 1 pipe 1 src-port 80 $ sudo ipfw add 2 pipe 1 dst-port 80
This works great when testing your apps in the simulator on your laptop, but clicking with your mouse on the screen and touching with your fat fingers on an iPhone are completely different experiences. Tanner and I each use iPod Touches as our development devices, which don’t have 3G chips – only wifi.
Testing the entire 3G user experience is possible on a device by slowing down your laptop’s internet connection to 3G speeds, sharing your laptop’s (now slower) wifi connection and connecting your iPod Touch to it.
To fake a 3G connection on your iPod Touch:
Returning your network’s connection back to normal is just as easy:
$ sudo ipfw delete 1 $ sudo ipfw delete 2
Someone should turn this into an app. I’d spend a buck on it because I’m a lazy bastard.
An article on the Yahoo developer blog states that about 1% of users to their collection of sites has Javascript disabled.
Makes sense. But what’s particularly interesting is when you express actual numbers:
The second takeaway is that JavaScript-disabled users exist. While 2% of U.S. visitors may not seem like a lot, keep in mind that over 300 million users visit the Yahoo! homepage each month. That means 6 million users visit each month without the benefit of JavaScript. So even though it’s worth spending your time on the JavaScript-enabled version of the site, there are still a non-trivial amount of users out there who won’t be able to use it.
While the percentage of visitors with JavaScript disabled seems like a low number, keep in mind that small percentages of big numbers are also big numbers.
My personal development style is to start with the scaffolding by writing the XHTML without any styling, make sure the site is still readable then add the CSS. After that’s in place, I wave my magic jQuery wand over it and make it do it’s tricks. This usually (USUALLY) ensures that a javascript-less user at least has access to the basics of the site.
But always, always, make sure that a visitor with javascript disabled at least has complete access to your login, contact and homepage. Always.
The Internet was ripe with new UX articles today. Here are the best ones I read:
If you’re testing new code, use your browser’s “private” setting to get a fresh, disposable canvas for your code.
Your new session will load without cookies, cache, history or saved form data. Better yet, all data you put into the window will disappear when you’re done. It’s a perfect way to find out if your code works from a new user’s standpoint instead of constantly cleaning out all of this info manually.
To start a new private window,
.bashrc is a ridiculously efficient time-saver if you do a lot of work in a terminal shell. I use it to create shortcuts (or “aliases”) for commonly-used commands, like restarting my Django server or including the path to a management script.
In one case it turns
/home/jeff/workspace/django-project-name/libraries/manage.py django-start 8084
into
djs
One more practical use is to create an alias for your project’s working directory. My local environment for Lookit is run on PHP through MAMP. For example, to access the root of my project (necessary to pull from Github), the original command
cd /Applications/MAMP/htdocs/lookit/
is now
lookit
This means I can do a pull for Lookit with one simple command, from anywhere in the file system:
lookit && git pull
But, OS X 10.6 doesn’t support .bashrc right out of the box. To enable this, open /etc/profile and add:
[ -r $HOME/.bashrc ] && source $HOME/.bashrc
Then, create .bashrc in your user’s home directory and start adding aliases:
alias mr='cd /Applications/MAMP/htdocs'
This means you can simply type mr into a Terminal window and hit enter, and it would have the same effect as if you had typed cd /Applications/MAMP/htdocs