enure » post

Serve CSS to Only Firefox

    @-moz-document url-prefix() {
      p { color: red; }
    }
    

Via i’m under construction

Reference: mozilla developer center

* * *

CSS3 Gradients in Webkit (Safari, Konqueror or Chrome)

Example 1: Gradient with 4 stops

 
    background-image:
              -webkit-gradient(
                linear,
                left top, right top,
                color-stop(0, #66D2E1),
                color-stop(0.4, #7FE386),
                color-stop(0.6, #C9D74E),
                color-stop(0.9, #9FEB70)
              );
    

Example 2: Two Gradients

 

This creates the same gradient as shown in figure 5 without the use of from and to.

    background-image:
              -webkit-gradient(
                linear,
                left top,
                left bottom,
                color-stop(0, #00abeb),
                color-stop(0.5, #fff),
                color-stop(0.5, #66cc00),
                color-stop(1, #fff));
    

More info

* * *

CSS3 box (drop) shadow in Webkit (Safari, Konqueror or Chrome)

 

Safari

Firefox

* * *

Getting an error report from Silverstripe when you're not in Dev mode

Append ?isDev=1 to your url to get error reports.

* * *

Getting around setTimeout global scope in javascript

// hide info messages after 10 seconds
    if (hasClass(msgs[i], "info")) {
        setTimeout(function(x) {
           return function(){
               msgs[x].style.display = "none";
           }
        }(i), 10000);
    }
    

via coding forums

* * *

Put a Mac to Sleep via the Command Line

osascript -e 'tell application "System Events" to sleep'

* * *

Grab Email Addresses from a Text File Using Grep

Via the command line:

grep -E -o --color "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b" source.txt > output.txt

* * *

Convert Kilometers to Miles in Your Head

The exact conversion rate is kilometers x .6214 = miles. Here is a simpler method which will get you close enough.

Example: 180 kilometers to miles

    >>> 180km / 2
    90m
    >>> 180km / 10
    18m
    >>> 90m + 18m
    108m

        

>>> 180km * .6214 111.85199999999999m

Example: 10 kilometers to miles

    >>> 10km / 2
    5m
    >>> 10km / 10
    1m
    >>> 5m + 1m
    6m

        

>>> 10km * .6214 6.2139999999999995m

* * *

(Quickly) Creating a Textmate Project From a Very Large Source Tree

Textmate can take a long time, in my case about 15 minutes, to load very large source trees. In the meantime the app is not accessible.

In my case I only need to work with a small subset of the source code, but the code is across several branches of the tree.

In order to keep all of the code I want to work on in one project, I have to use the “Folder Information” feature, which allows you to ignore specified folders. To access this usually you create a project and then select the root folder and then click the (i) button at the bottom of the navigation drawer.

However, in order to actually get to this point you have to open the entire source tree as a project in Textmate, which is a bummer.

To workaround, create a dummy project from an empty folder, or duplicate an existing .tmproj file. Now open the dummy.tmproj file in Textwrangler or some other editor and edit as needed. It is just XML. You can delete most everything excepting the key documents.

* * *

Seattle Area Pollen Seasons

* * *

Setting up a Static Ip for Mac Os X on an Actiontec GT 701 WG So One Can Set up Port Forwarding

  1. Set DNS to start at 192.168.0.100. The point here is to start it above where it usually starts at.
  2. Set your TCP/IP connection to use ‘DHCP with manual address’. This is how one does this in Mac OS X, I’m not sure about other OSs.
  3. Set your IP to 192.168.0.11, or any other number below what you set DNS to start at.

This will set up a static IP in a DHCP environment, e.g. you don’t have to set all of the computers on the network to use a static IP. And, you can now successfully set up port forwarding.

* * *

How to use SVN to Publish Content to Your Website

Say you’ve started using svn to manage your website content. Now when you commit you want to push changes to your your website.

  1. ssh into your account
  2. back up your web directory: mv www www.old
  3. make a new web directory: mkdir www
  4. cd www
  5. check out your repository to your web directory. similar to wget, you need to be specify the correct syntax so that your svn files checkout nicely so that your web directory shows your index page. For instance check out the correct path from your svn repository to the current directory (the period): svn co http://svn.url.com/trunk/www/ .
  6. to prevent visitors from browsing into your .svn directories add the following to your .htaccess file:
    RedirectMatch 403 /\.svn.*$
  7. then each time you commit changes you update your local repository in your web directory. there are a couple ways to do this, one is to use one of the svn pre-commit hook to do this automatically, another is to write a script to log into your account and update it, e.g. ssh host 'cd www; svn update; exit;'. at this point it’s quite handy to have passwordless authentication set up with the relevant account.

* * *

Using ssh-keygen to log in securely without a password

To generate a secure public/private key pair to log in securely, and without a password.

At the command line:

  1. ssh-keygen -d
  2. hit return three times
  3. ssh username@ftp.yourdomain.com 'test -d .ssh || mkdir -m 0700 .ssh ; cat >> .ssh/authorized_keys && chmod 0600 .ssh/*' < ~/.ssh/id_dsa.pub
  4. press return
  5. wait for it to say Password
  6. enter the password
  7. You’re now signed in.
  8. exit
  9. Now you can test it: ssh username@ftp.yourdomain.com

“Source”:http://blog.dreamhosters.com/kbase/index.cgi?area=138

* * *

An Early Case of Road Rage

Oct. 17, 1904: “Roy Lewis, a very ‘fresh’ kid, had J.A. Walkey arrested for battery … because the latter boxed his ears when he deserved it,” The Times reported under the headline, “Speedy Boy Clouted and Lectured.”

Lewis had been “hitting up a good pace” on his bicycle on Aliso Street “when Walkey undertook to cross, regardless of the dinging of the boy’s bell,” the newspaper said.

“Lewis refused to turn out and went so close to Walkey that he ran over his foot and then fired vile names back at him. Walkey ran after him and clouted him for his impudence.”

In court, Justice H.C. Austin “added to the lad’s discomfiture by giving him to understand that the dinging of his bell was not to be understood as notice to the people to clear the street” and that he would be punished if he showed up in court again, The Times said. As for the pedestrian, the newspaper said, “Because Walkey actually struck the boy, he was fined $1, but was not required to pay it.”

* * *

Ignoring Files and Folders in Textmate Projects

If you’re working on a large project with other folks, you may sometimes have a need to ignore large sections of the project. For instance, you may be working on a large web application, and you may only care about 5% of the project, possibly just the jsp, css and javascript.

Including the entire file tree in Textmate is a pain, as Go to File and Find in Project become cumbersome and inefficient. Further, I’ve found Textmate to be slow if the project is overly large.

Use separate Textmate projects for each folder you care about…

This is rather crude, and it’ll force you to switch between different Textmate windows. It’s rather limiting.

Remove Selected Files...

You could select folders and files in the project and choose to Remove Selected Files.... You are given the choice to delete the files, or remove the references. This is easy, but if files appear dynamically, you might run some build script, then the files will appear each time and you’ll have to repeat the process. This gets rather annoying.

Use Folder Information Dialog

A more powerful feature, but quite hidden, is to use the Folder Information dialog, you can choose to hide folders or files based on a regular expression. To access the dialog, choose the top-most folder in your project and then control-click and click Show Information.... Add folder names as necessary to hide folders and their children. This can be rather tedious in a large project, but if you’ll be working in the project long-term it’s worth it.

The bugger with this method is that it first requires you to load the entire source tree in Textmate, which can take a long time. Here is a workaround.

To hide a folder, add it to the pipe-separated list.

* * *

Snowfall in the United States

Source: Climatesource.com

* * *

Sunshine in the United States

Source Accuweather.com

* * *

a lightweight and simple php photo gallery

Displays collections of images.

* * *

using csstidy with textmate

  1. download csstidy
  2. use it.

* * *

shortcuts for working with text on mac os x

Control-A
Moves your insertion point to the beginning of the paragraph. (Mnemonic: A = beginning of the alphabet.)
Control-E
Deposits your insertion point at the end of the paragraph. (Mnemonic: E = End.)
Control-D
Forward delete. (Deletes the letter to the right of the insertion point.)
Control-K
Instantly deletes all text from the insertion point to the right end of the line. (Mnemonic: K = Kills the rest of the line.)
Control-O
Inserts a paragraph break, much like Return, but leaves the insertion point where it was, above the break. This is the ideal trick for breaking a paragraph in half when you've just thought of a better ending for the first part.
Control-T
Moves the insertion point one letter to the right--and along with it, drags whichever letter was to its left. (Mnemonic: T = Transpose letters.)
Option-Delete
Deletes the entire word to the left of the insertion point. When you're typing along in a hurry, and you discover that you've just made a typo, this is the keystroke you want. It's much faster to nuke the previous word and retype it than to fiddle around with the mouse and the insertion point just to fix one letter.
Four additional keystrokes duplicate the functions of the arrow keys. Still, as long as you've got your pinky on that Control key.
Control-B, Control-F
Moves the insertion point one character to the left or right, just like the left and right arrow keys. (Mnemonic: Back, Forward.)
Control-N, Control-P
Moves the insertion point one row down or up, like the down and up arrow keys. (Mnemonic: Next, Previous.)

source » m tsai

* * *

why trains go clank clank clank clank clank when they start moving

Southern Pacific Co. v. Arizona, 325 U.S. 761, 776 (1945)

This free movement results from the fact that in railroad practice cars are loosely coupled, and the coupling is often combined with a shock-absorbing device, a “draft gear,” which, under stress, substantially increases the free movement as the train is started and stopped. Loose coupling is necessary to enable the train to proceed freely around curves and is an aid in starting heavy trains, since the application of the locomotive power to the train operates on each car in the train successively, and the power is thus utilized to start only one car at a time.

* * *

key bindings in mac os x. set shift delete to delete forward system-wide (ala BBEdit)

maybe you recently moved over to using Textmate, and you really can't get used to shift-delete not deleting forward.

  1. mkdir ~/Library/Keybindings
  2. nano ~/Library/Keybindings/DefaultKeyBinding.dict
    /* ~/Library/KeyBindings/DefaultKeyBinding.dict */
    {
    "$\010" ="deleteForward:"; /* Shift-backspace */

    "$\177" = "deleteForward:" /* Shift-delete */
    "^=" = "moveToEndOfLine:" /* move to end of line */
    "^-" = "moveToBeginningOfLine:" /* move to begining of line */
    }

    

then reboot.

note these keybindings did not work on my work computer, a desktop G5 with, of course, a different keyboard. i found these codes, which were diff. than i found elsewhere, from someone setting up keybindings to match vi.

* * *

bicycles made in the United States

Burley, Eugene OR
Calfee, La Selva Beach CA
Lightfoot Cycles, Darby MT
Waterford, Waterford WI
Alpine Designs, Sandpoint ID
Rivendell, Walnut Creek CA
Rodriguez, Seattle
David Wilson Industries, Seattle
Vanilla, Portland
DeSalvo, Ashland
Ira Ryan, Portland
Strong Frames, Bozeman
Vail Cycle Works, Vail

I left off all of the recumbents. There are a ton of them, but I have no interest in them.

* * *

bicycle helmets in king county

70% of adults and 50% of children in King County wear bicycle helmets – the highest incidence in the nation.

Source: Harborview Medical Center

* * *

using rsync with Textmate to sync local and remote files

  1. Set up passwordless authentication to securely sign in to your remote host without keyboard authentication. Otherwise you will have to enter your password each time your run the command, and as well you won’t be able to synchronize from Textmate.
  2. To “perform a trial run with no changes made”, run this command in the terminal: rsync -e "ssh -i /path/to/keygen" -auv --delete --dry-run ~/path/to/local/content/ remoteSSHUser&#0064;remote-server.org:/path/to/remote/content/.
  3. Once you have it right, remove remove --dry-run and add the command to Textmate via a bundle.

Extra Credit

Use Textmate variables and the command will work for each of your projects (thanks to Allan and rbrtrx via the Textmate IRC channel)

Notes

Using Transmit’s Synchronize Feature

Note: Using Panic’s Transmit you can use the synchronize command, which allows you to either update or mirror your files (from client to server or vice-versa). This does essentially the same thing as rsync, however you have to switch apps over to Transmit from Textmate, select the command, confirm your action twice and then watch the files go. Short term this is more efficient than setting up rsync, ssh and textmate.

Using SVN

I’ve stopped using rsync altogether. SVN allows one to work across multiple machines and merge changes, revert changes, compare previous versions, etc. etc. Textmate has a very capable SVN bundle, and dreamhost provides easy administration of svn repositories.

* * *

google tip: find files of a certain extension and your search terms

use the following syntax in google to find files of a certain extension and your search keywords.

?intitle:index.of? .mp3 "sufjan"

in terms of mp3’s this usually finds:

you could then use wget to batch download the files

* * *

using wget to grab all images from a web page

the command

explanation

more on wget

wget on mac os x

wget does not ship with mac os x. you can find a pre-compiled version of wget at status-q. if you don’t want to install wget, you might try out curl, which is already installed.

making curl behave like wget

this will output to a file, rather than printing to the screen.

* * *

michael albert of z magazine speaking about lessons from the new left

lessons to be learned from malcolm x, bobby seale, huey newton, earth first!, black panthers, weather underground, tupac shakur’s mother, robert kennedy, MOVE, john africa, fred hampton, berkeley free speech, SDS, the sixties, etc. as presented by michael albert of z magazine in a speech entitled lessons of the new left [5MB mp3].

* * *

Tread on Tires and Bicycling

From: Christopher Wallace
Subject: CCM Tire tread
Date: June 22, 2005 11:55:35 AM PDT
To: CHI-CRIT-MASS@UIC.EDU

Part 1

Tread is not understood well, Here are some basics: the more tread you have the less you will stick to the stone that pavement is made of. If you are on soft soil, tread will dig in to the mud or soft dirt and offer less slippage. Tread is a combination of rubber columns, walls, peaks, towers, and AIR spaces between them. The air spaces between tread offer less rubber to touch the stone pavement. Now for some reason intelligent people believe that you can dig into stone with rubber ( this amazes me, Rubber is softer than Stone, It will NOT dig into it!) With this idea that tread cuts into stone, they then think they will get more adhesion on pavement with less rubber (Remember the air gaps between tread) touching the stone the road is made of. Tread does offer some benefits as I describe in part two, but tread does not help you stick to stone pavement.

Racing tires for NASCAR, INDY, CART, NHRA drag racing,AMA motorcycle racing, go-carts, and rock climber shoes, all use tread less rubber. Tread less rubber places the most amount of rubber on the stone surfaces and sticks to the stone much better than any tread will. The rubber compounds are designed to deform slightly to the shape of the rock and grasp as much stone surface as possible. This is why they stick so well.

Tread knob towers, or walls, or peaks, can all bend over when a load is applied to them, this is bad for adhesion. Start with the idea of a knobby tread tower. It strikes the ground with the front edge of the tower then as you roll forward the whole top is in contact with the pavement. Continue rolling and the tower lifts off the pavement rear edge first. When we accelerate the towers get bent over and the back edge is the only part touching pavement. Think about this: instead of the whole top of the tower touching the stone surface, now just a little edge is touching. There is almost no rubber touching the pavement at all. Now place side loads of turning into a knob and you will see you have very little rubber from the knobby touching the ground, PLUS there is a lot of air around and between each knob. When I get in to a hard turn on a knobby, I can hear the tire slipping on the surface as it makes a louder noise than when I am rolling in a straight line.

RAIN: A car will start to hydroplane in deep water at 45 miles per hour. Do I really have to go much farther with this explanation on why it is hard to hydroplane on a bike? Who here goes 45 mph on their bike in the DRY much less the rain?

When slick tires first came out there was an add in Cycling Magazine where a person in full motorcycle protective crash leathers and a full face helmet was leaned over 45 degrees on pavement while running through a puddle. The tire company was trying to show the tire would stick on wet pavement. I thought it was a hoot that the rider was still afraid of the photo shoot test that they wore leathers.

During rain any petroleum based and steel surface will become slick to rubber. Paint is made of oil and will be slick, oil on stone will become slicker, polished steel lids on streets will become slicker. Sorry no tire will stick to any of that.

Snow is cool, a thin slick tire will cut and push though snow and get to rock pavement, stick nicely. Only steel studded tires will stick to ice, but they suck on stone pavement.

Wet Grass is where tread is soooooo cool. Now how often are you carving up the park grass on your knobbies in the morning dew or after a rain, or during a cycle cross race? If you are off road in soft soil GET some knobbies. If you want to stick to stone pavement the tread will not help.

Part 2

Tread is cool. A slick tire will stick to little flakes of glass and pound them into the rubber. Most do not cause flats, they just cut up the rubber and are annoying. Some will cause flats. Tread on the other hand will bend over in a turn and allow glass to be scrubbed out as the tread slides across the pavement and some glass will pop out. The air spaces between knobs are impossible for little glass flakes to stick to. Now we all get flats from bigger glass pieces, wire, screws, thumbtacks, and thorns. Bigger objects will defeat tread benefits.

Source: Chicago Critical Mass Mailing List

* * *