Wednesday, July 22, 2015

Remove added file from git

git rm --cached filename.ext

via http://alvinalexander.com/git/git-rm-file-git-repository-dont-track-accidentally-added

lsn

Added
alias lsn="ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr(\$1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(\"%0o \",k);print}'"
to my .bashrc and now I can view unix file permissions as numbers via `lsn`:

$ lsn
total 17
644 -rw-r--r-- 1 brent Administ 21655 Apr 18 2014 default.php
755 drwxr-xr-x 17 brent Administ 0 Apr 18 2014 files
644 -rw-r--r-- 1 brent Administ 11082 Apr 18 2014 settings.php

Friday, February 25, 2011

My new favorite Greasemonkey Script

Block experts-exchange from all Google search results!

No Experts Exchange UserScript
 
Now thanks to the magic of Geasemonkey there's more Experts-Exchange cluttering your searches.

Since I use the HTTPS-Everywhere Firefox Add-on from the Electronic Frontier Foundation, I had to add a line to the script to also block Experts-Exchange on https://encrypted.google.com.

Here's the full script with my edit:
// ==UserScript==
// @name           No Experts Exchange
// @namespace      JRice
// @description    We HATES them, Exchange, dirty Expertsses!
// @include        http://www.google.com/*
// @include        https://encrypted.google.com/*
// ==/UserScript==

var count = 0;
list = document.getElementsByTagName('a');
for (i=0; i

Thursday, October 21, 2010

gis.stackexchange.com

The best programming site on the net, now has a dedicated GIS section at gis.stackexchange.com.  Not much else to say here.

Monday, September 20, 2010

Simple HTTP Redirect with Querystring in IIS7

HTTP Redirect seems simple enough. Always was in IIS6 and in IIS7 there's even a button labeled HTTP Redirect that promises relative redirects.  It looks like it'll be as easy Apache finally.  That is until you try to redirect a querystring.  Then everything bombs.

Turns out it still is relatively easy, except you have to know that Microsoft changed $S$Q to $V$Q. Why? $Ss and $Gs I suspect.

And How.
In our example we'll redirect all pages under http://olddomain.com/content to http://mydomain.com/content.
  1. Pick the virtual directory you want to redirect. e.g. http://olddomain.com/content
  2. Click HTTP Redirect under IIS in the IIS management console.
  3. In the HTTP Redirect Dialog:

    • Check Redirect requests to this destination
    • Enter your new path ending with $V$Q.  e.g. http://mydomain.com$V$Q
    • Counter-intuitively check Redirect all request to exact destination (instead of relative destination)
    • Choose the appropriate Status Code (Permanent or Temporary)
  4. Apply Changes and Test

Wednesday, September 15, 2010

SEO is officially dead

Yes, I know we're all tired of hearing that some technology is dead. Wired was wrong about the web dying in 1997 and 2010. Truth be told Wired isn't exactly good at identifying mortality. Phone calls aren't dead, the desktop isn't dead, cyberspace isn't dead, drm isn't dead, wifi isn't dead, guitar hero isn't dead and DRM isn't dead, yet (though Zuckerman is trying his best). Well, they were right about the floppy disk.

Wait. That wasn't my point.

My point was that SEO is *actually* dead.

Here's why.

Several minutes ago I google "fckeditor background marinelli". I find a solution that works. Using it I figure out a better way. I blog it. I hit the back button to review the search results again. My blog entry (I just typed) is result six.

http://lmgtfy.com/?q=fckeditor+background+marinelli

SEO is dead. Long live content. Thank you Google Instant.

Theming fckeditor to work with Marinelli Drupal Theme

Marinelli, a nearly flawless Drupal theme has one major flaw. It is not optimized to work with the fckeditor WYSIWYG editor. There are others as well.

Some googling located some good tips for configuring modules/fckeditor/fckeditor.config.js to work with Marinelli on http://drupal.fckeditor.net/tricks. This solution is good, but it doesn't work well in multi-site situation or if more than one theme is enabled.

Here is a simpler solution:

  1. Go to admin/settings/fckeditor and select "edit" next to the profile you want to fix.
  2. Make sure under "Style and template files" your Editor CSS is set to "Use theme CSS"
  3. Under "Advanced Options", find "Custom javascript configuration" and paste the following:
    FCKConfig.BodyId = "primary";
    FCKConfig.BodyClass = "singlepage";
    FCKConfig.EditorAreaStyles = "body{background:#FFFFFF;text-align:left;font-size:0.8em}";
    
  4. Spank "Save"

If you are running a multi-site installation as I am this is really the way to go as I share my fckeditor module via sites/all/modules.

Another option is if you want to go all kind of whacky with your javascripting is to create a separate fckeditor.config.js in your theme directory and choose "Yes" under "Advanced Options" > "Load fckeditor.config.js from theme path."