Oct
15
2011
0

Simple Indent for HTML TextAreas

Part of my job involves me occasionally editing css, html, xml, javascript, etc inside of html textareas. Pretty cumbersome, but it makes sense for us and I won’t bore you with the details. One thing that drives me nuts is having to manually indent each line of code that I write using the spacebar. This gets old quickly and typically turns into a big mess.

Today I whipped up a jQuery plugin called SimpleIndent. When used on a textarea, the textarea will magically remember indentation (spaces only, no tabs). Oooooh, aaaaah. Now that shitty old textarea is almost useable for coding! Ok, not really, but it’s a hell of a lot better.

The plugin is invoked like this:

jQuery(‘textarea[name="body"]‘).SimpleIndent();

Just replace ‘textarea[name="body"]‘ with the selector for your textarea and you’re good to go. I know there are a lot of serious html/js code editors out there, but I didn’t need all of the functionality and it was more fun to write something myself :-)

Update: Decided to make a Chrome extension for this. Just load this directory from the github repo into Chrome (Window>Extensions then “Load Unpacked Extension”), click the cheesy “SI” icon and the popup link, click a textarea, and you’ll instantly have simple indentation. WORD. FYI, don’t try it on a textarea that already has SimpleIndent applied to it (like the link above). It’ll blow up :-) I’ll fix that eventually. Or maybe I won’t.
Written by choochburger in: html,javascript,jQuery |
Oct
10
2011
0

Everyday I’m Tunneling

I recently moved to Southeast Asia and, as expected, a whole bunch of sites don’t work for me here (Hulu, Netflix, etc). The country I’m living in also blocks a lot of other *viewing material* that is easily accessible in the US, if you know what I mean… and I think you do, you slob :-)

No need to worry, if you have access to a server in the US (I use linode.com), you can most likely tunnel your traffic through it via ssh. Here’s how I did it:

First off, make sure that your server’s /etc/ssh/sshd_config file contains the line:

AllowTcpForwarding yes

You may not need this line, but if it’s set to “no”, you’ll have issues.

Then, type the following into your OS X/Linux terminal (this can also be accomplished easily using PuTTY on Windows):

ssh -D 9999 yourusername@yourserver.com

9999 is an arbitrary portname. Feel free to adjust to your liking. You can also append the “-C” flag to enable compression, although I haven’t really messed around with this. Enter your password and you’re almost there!

Next, pop into your favorite browser (I’m using Chrome on OS X at the moment). In Chrome select:

Chrome>Preferences>Under The Hood>Change Proxy Settings

This will bring up your system network preferences. Check the box next to “SOCKS Proxy” and enter:

127.0.0.1 for the address and 9999 for the port (or localhost/whatever port you entered earlier)

Click OK and then Apply… Boom! You should be good to go. Traffic will be routed through your remote server and you should be able to view sites as if you were in the US!

Note: This will forward traffic for all browsers through your server. Browsers like Firefox allow you to set up a proxy for just that browser. I’m sure you can do that in Chrome/Safari, but I don’t really care to figure out how. Google it, I’m sure it’s easy :-) Just make sure to disable this when you’re done. Oh yeah, if you’re in Firefox, ONLY enter this info into the “SOCKS host” field. Leave all of the other fields blank.

Written by choochburger in: Linux |

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes

Switch to our mobile site