6-4-2012

Mac OS X Lion: Two fingers back/forward on Safari/Firefox

When I switched to OS X 10.7, the biggest change, beside the scroll direction, was the fact that I couldn't go back or forward by swiping two fingers on the Magic Mouse.

To fix this go to System Preferences -> Mouse -> More Gestures and change Swipe between pages to Swipe left or right with two fingers

4-28-2012

Snow Leopard: mod_rewrite not working on apache2

mod_rewrite didn't work on Snow Leopard for sites that where located under /Users//Sites. The reason being that there's a second configuration file for Apache specific to this location and to your Mac user.

To make mod_rewrite work under Mac OS X Snow Leopard 10.6 you have to:

  • Open the following file /etc/apache2/users/.conf where is your Mac username.
  • Add FollowSymlinks to the Options and change AllowOverride to All
  • It should look like this:
5-14-2011

WordPress: Get Tag ID using only the Tag Name

Useful when you're on a Tag Template or using the is_tag() conditional outside The Loop, WordPress gives you the single_tag_title() function which returns the Tag Name and you can use this function to find the Tag ID:

whos.amung.us plugin for ServerDensity

Just change YOUR SITE ID and YOUR SITE NAME to the appropriate values.

4-10-2010

Simple JavaScript Timer

Take advantage of Javascript's Date object to create a simple timer.

Just create a div and set it's id attribute to show_timer_div, use the other functions to start/pause/stop the timer.

<div id="show_timer_div"></div>
<a href="#" onclick="startTimer();">Start</a> | <a href="#" onclick="pauseTimer()">Pause</a> | <a href="#" onclick="resetTimer()">Stop</a>

Demo: Simple JavaScript Timer

It starts by showing 00:00/minutes:seconds then adding the seconds as they come by, if it reaches hours it starts showing 00:00:00/hours:minutes:seconds.

4-10-2010

Online users with MongoDB and MongoMapper

Using MongoDB and MongoMapper, on ruby. It's designed to recognize users by the IP address and save the page they're currently on. It can be easily changed to use usernames.

4-10-2010

Scroll the browser window using jQuery without any plugin

You can use .offset() to get the position of an specific element to scroll to, or use $('body').height() to move to the bottom of the document.

4-10-2010

Using markdown with App Engine

  1. Download the *nix source from Markdown for Python and extract the content.

  2. Inside the extracted source you'll find a directory called markdown, copy this into your App Engine application folder.

  3. Import into Python and use it:

     import markdown
     html = markdown.markdown("source text")
    
4-10-2010

Rails form_for() :multipart

In Ruby on Rails you can set :multipart => true on form_tag() and it will return a form tag with the proper enctype for uploading files. However, you can't use :multipart directly on form_for().

The work around is to set enctype directly to the :html of the fom_for():

form_for(@post, :html => {:enctype => "multipart/form-data"})

Which will return something like:

 <form action="/posts" enctype="multipart/form-data" method="post">[...]
4-10-2010

Anonymouseit Bookmarklet

Whenever a page/site doesn't load, I try it behind a proxy to see if the problem is on my end.

I created this simple Bookmarklet that takes the url from the current window and opens a new window with the same page anonymouse'd.

Code:

javascript:function Anonymouseit(){
    var url=prompt("URL to Anonymize:", window.location);
    if(url){
        window.open("http://anonymouse.org/cgi-bin/anon-www.cgi/"+url);
    }
}
Anonymouseit();
Older posts