Categories
MAC Tutorial

Let the Mac Sleep

When you step away from your Mac, knowing the right keyboard shortcuts can save time, conserve energy, and extend your battery life. After spending considerable time researching, I discovered these essential shortcuts that every Mac user should know.

The Two Types of Sleep

Your Mac offers two different sleep options, each suited for different situations:

Put Mac to Sleep Immediately

Cmd + Opt + Eject

Categories
Emacs Programming Technology Tutorial

Power Programming with Tags

Source tagging is a powerful source code navigation system that rivals modern IDEs. If you're using Emacs, Vim, or TextMate, you can use ctags for fast code navigation. Here are the steps to set it up.

Step 1: Install ctags

For Mac:

$ sudo port install ctags

Step 2: Create a Tag File

Navigate to your project and generate tags:

Categories
Programming Web Development

Prevent Googlebot Following Links in Gmail

If you run a mailing list or send automated emails with links, you may have noticed something strange: Googlebot is following links sent to Gmail subscribers, which can trigger unsubscribe actions or inflate download counts.

Why Common Solutions Don't Work

The typical approach—using robots.txt or adding rel="nofollow" to links—doesn't work for email links. These methods only apply to web pages, not email messages. When Gmail displays emails in the web interface, Googlebot can still crawl those links.

The Solution: User Agent Filtering

The best approach is to detect and handle Googlebot requests at the server level. Check the user agent string in incoming requests and filter out bot traffic before processing actions like unsubscribes or incrementing download counters.

Categories
Emacs Productivity

Searching in Buffers with Occur Mode in Emacs

I spend most of my day in Emacs, and a significant part of my work involves searching for code—finding function definitions, tracking down variable usage, or looking for TODO comments across multiple files. While Emacs has powerful search tools like grep-find and find-grep, there's often a better option: occur-mode.

The Problem with Traditional Search

When you use grep-find or similar tools, you're searching your entire project directory. This has two problems:

Categories
Learning Personal Growth Programming

Stop Doing What You’ve Always Done

If you keep on doing what you've always done, you'll keep on getting what you've always got.

W. L. Bateman

Categories
Command Line Development Tools Linux

tmux: A Better Alternative to GNU Screen

I've been a long-time user of GNU Screen, and I've always recommended it to anyone working with remote servers. Screen is an excellent tool that's saved me countless times when SSH connections drop or I need to run long-running processes. But it has one major problem: it's tough to configure and learn.

Recently I discovered tmux, and I'm making the switch. If you're not familiar with terminal multiplexers or you're struggling with Screen's complexity, tmux might be exactly what you need.

Categories
CoffeeScript JavaScript Programming

Getting Started with CoffeeScript: JavaScript’s Better Half

Introduction

I love JavaScript, but let's be honest – the syntax can be clunky. Verbose function declarations, confusing this binding, lack of classes, awkward loops. JavaScript is powerful, but it could be prettier.

CoffeeScript addresses this. Created by Jeremy Ashkenas (of Backbone.js and Underscore.js fame), CoffeeScript is a language that compiles to JavaScript. It keeps JavaScript's good parts while fixing the annoying bits.

Categories
Cloud Deployment Heroku Ruby

Deploying Ruby Apps to Heroku: Git Push to Production

Introduction

Deploying web applications used to be painful. Set up a server, configure Apache, install dependencies, manage databases, worry about scaling. It was complex and time-consuming.

Heroku changes this. It's a cloud platform that runs your Ruby applications with minimal configuration. Deploy with git push. Scale with a slider. Focus on code, not infrastructure.

Categories
CSS Mobile Web Design

Responsive Web Design: Building Sites for All Devices

Introduction

The mobile web is here. iPhones, Android phones, iPads – users access the web from dozens of devices with different screen sizes. The traditional approach of building separate mobile sites is becoming unsustainable.

Enter responsive web design, a term coined by Ethan Marcotte in his recent article on A List Apart. The idea is simple but powerful: use CSS to adapt your site's layout to the viewing device. One site, one codebase, works everywhere.

Categories
JavaScript Node.js Server-Side

Introduction to Node.js: JavaScript on the Server

Introduction

JavaScript on the server isn't new. We've had Rhino, SpiderMonkey, and other JavaScript engines for years. But Node.js is different, and it's generating serious excitement.

Released last year by Ryan Dahl, Node.js takes Chrome's V8 JavaScript engine and wraps it with APIs for file I/O, networking, and other server-side tasks. The result is a platform for building scalable network applications using JavaScript.