Javascript / JQuery: Detecting the delete key

Recently I was using JQuery to detect when the delete key was pressed. I was having some issues getting it to work. I was listening to the “keypress” event, but the delete key was never detected.

$('html').keypress(function(e){
    if(e.keyCode == 46) {
        alert('Delete key pressed');
    }
});

After a bit of research I realized that “keyup” made more sense. “keypress” is for printable characters. “keydown” and “keyup” will capture all characters

$('html').keyup(function(e){
    if(e.keyCode == 46) {
        alert('Delete key pressed');
    }
});

I hope this helps someone else down the road that may be stuck on this.

Atom IDE: “EACCES, permission denied” error message

Atom IDE

EACCES, permission denied

That was the error message that I received when I was trying to update my Atom packages (I think it was linter-php). Basically, the updater was failing because it didn’t have permission to remove an old config file. The fix was simple enough. All I had to do was resign the permissions to my user by running the following command:

sudo chown -R `whoami` ~/.atom

Easy as that the permissions were fixed and the updater could do its thing again.

So I’m writing a book

book_writingIn early 2013 I started writing a book.I didn’t get far before starting work on other projects.

Its August of 2014, and I’ve started working on my book again. It’s about SEO and SMO (Search Engine Optimization and Social Media Optimization). Currently it’s about 100 pages completed. I’ve started and stopped this project more that any other project in my life. Today I took some time to reflect on why it’s taking me so long to complete this task.

Through writing this book, I’ve realized that it’s difficult for me to convey my thoughts and ideas on a page. I can make it happen, but I’m very slow at it. Truthfully I am more comfortable writing computer code.

To me, code has a personality and a life of it’s own. I go to war when I code. Code does not want to run, you have to wrestle into submission. You have to understand it, you have to anticipate it. You have to imagine all of the different ways your code is going to try and elude you, and crash. Like all worthy adversaries, you must respect the code to truly understand and master it. For the code to run, you must be successful, you must be correct. The poetic dance that I experience with code, I don’t feel when writing in English. Maybe it’s the linear fashion and format.

I can say however that the research process has been fun, and stretching myself to write this book has been a great experience and a true challenge. I am passionate about seeing this project through. Here’s to the future, and here’s to completing this bad boy!

PageKite – An awesome tool for serious web developers

If you have done any serious web development, you know how important it is to have a local environment to work in.

It’s not very hard to set up a local web server, database server, and just start banging out code. If you have a mac, you don’t even need to install anything to start a PHP or Python project.

Development problems comes into play when you reach a point in your project when you need to start making inbound calls for things like oAuth or web hook callbacks. For these sorts of things to happen, you need your dev machine exposed to the world, and presented in an addressable format, or upload the whole project to a production server – both, a pain, and a time suck when you are developing.

Exposing your web server to the world usually requires a few modifications and a little bit of know how. Once ready to expose to the world, you need to open firewall ports and advertise your IP Address. If you are like me, and program on the run (office, home, coffee shop, airport, etc), I don’t always have access to router / firewall / port forwarding settings. Technically it’s against the Terms Of Service of my internet provider to expose a web server on my connection, so I CAN’T open any web server ports.

Enter PageKite to save the day.

PageKite is a cool project out of Iceland (yes Iceland!), that solves the problems I listed above. PageKite makes local websites or SSH servers publicly accessible in mere seconds, and works with any computer and any Internet connection. It’s also 100% Open Source. It’s dead simple to use. You just need python installed on your machine (which serious web developer doesn’t have python installed?), and the pagekite.py file from pagekite.net.

For $4 a month, you can’t beat the ability to run a simple lite weight script that securely exposes your web server to co-workers, API services, and anyone else you can think of. You probably don’t want to run a production level server via PageKite, but it gets the job done for development work, and it does it in an amazing way.

The best part is the fact that it doesn’t matter what type of connection you are on, you can expose your work to whoever wants to see it. No firewalls, no dynamic IPs, no hassle. I’ve used PageKite to build my last two Shopify apps, SEO Meta Manager, and Order Lookup App. It’s been nothing but an awesome experience. PageKite has found a permanent place in my web dev tool box.

check it out at http://PageKite.net. The Video below is a bit long but explains it very well.

[youtube]https://www.youtube.com/watch?v=7a66r23jnKA[/youtube]

Working with Shopify .css.liquid files in TextMate

I’ve been working with Shopify.com for some time now. One of the(many) cool things that Shopify has going for it, is the TextMate bundle they offer. It really makes writing Shopify Liquid code much nicer.

If you’ve ever working on a Shopify theme, you’ve most likely delt with a .css.liquid file. It’s a CSS file that contains a tiny bit of liquid code (mostly for linking to assets like background images). By default, TextMate will treat these file like liquid files. They really should be treated as CSS files.

To fix this, in TextMate, press cmd+option+control+L. This will open the “Bundle Editor”. Expand “CSS” in the navigation pane on the left.

In the right window, find:
fileTypes= (

Add “css.liquid” to that list. Look at the below image for an example.

 Restart TextMate and you should be read for some Shopify CSS goodness.