Tuesday, November 16, 2010

Ultimate CSS Gradient Generator

http://www.colorzilla.com/gradient-editor/

Tuesday, August 3, 2010

Flare Video

My buddy Joey found a great free h.264 video player that you can customize.

http://www.flarevideo.com/

Check it out

Friday, June 18, 2010

jQuery Pirobox

Need an awesome way to display your pictures on your site. Check out pirobox.

http://www.pirolab.it/pirobox/

Saturday, June 12, 2010

Fixed Background Image

In CSS:
background:#42021E url(images/bg.png) repeat-x;
background-attachment:fixed;
}

If you want to learn more about backgrounds, you can read up at w3chools.

Wednesday, June 9, 2010

How to get www in front of your URL

So my website, www.moderncurio.com is missing the "www" in front of it's name. Apparently it's a common occurrence that will 15 minutes to fix and weeks to resolve.

The solution is a two part fix. The first leg involves setting up Google Webmaster Tools. After you verify your sites (both the www and non-www). Go to Site Configuration > Settings > Preferred Domain and set it to "Display URLs as www.example.com"

Part two of the solution is to set up a 301 redirect and you can do that by adding the code below to your .htaccess file:

# non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]


To learn more, read up on more on 301 redirects.

After all this, it'll take a while for google webmaster tools to take effect. Apparently, it takes weeks for Google Webmaster Tools Blog to configure itself. You can learn more about the process at the tools.

------

NOTE: WORDPRESS USERS:
For WordPress Users, you will also need to change a setting in wordpress general settings and set your preferred URLs to have www.

Sunday, June 6, 2010

Online Favicon Maker

I know this isn't code related however I thought this would be good to track.

I needed to make a favicon today so I used this online site to generate it.

http://www.degraeve.com/favicon/

Helping the Browser Locate the favicon.ico file

http://www.thesitewizard.com/archive/favicon.shtml

Thursday, May 20, 2010

Subversion: Accidently SVN RM'd a file or folder?

*points finger*... laughs.

If you accidently svn rm'd a file or folder. Don't stress out. As long as you didn't svn commit the change, you're fine. All you have to do is run:

For a file:
svn revert file_name

For a folder:
svn revert --recursive folder_name

You can also do this to a file or folder that you ran svn add on.

Ruby: Inserting Table Data into your messages

So I wanted to improve the UI of a feature that I was building by having the alert include the actual name of what I modifying and at what time. There is a specific syntax used to insert it and it looks like this within the control structure.

if var.updated_at

show.now[:alert] = "Your client, #{var.name} came at #{var.modified_time}."

end

Wednesday, May 19, 2010

Ruby: if elsif elsif else statements... ya... they do exist.

I'm not crazy... just a n00b.

------------------------------------

# if, elsif and else illustrated

print "What distance in miles? "

miles = STDIN.gets.to_f

if miles < 2
puts "walk"
elsif miles < 6
puts "cycle"
elsif miles < 30
puts "bus or drive"
elsif miles < 350
puts "train"
else
puts "don't bother"
end

print "#{miles} miles is #{miles/5*8} kilometres\n"

Link for more info.

Tuesday, May 18, 2010

Terminal & Rails Console: Basic Navigation

So to show how much of a n00b I am, I am tracking the four commands that the pros use the most in this blog.

Control A - Beginning on the line
Control E - End of the line
Meta F - Forward one word
Meta B - Back one word

Note:
If you don't have Meta set up on your keyboard yet for your mac. In your Terminal > Preferences > Settings > Keyboard > Check box "Use option key as meta key"

jQuery: html anchor (slide the scrollbar)

As we know, anchor tags are great to navigate within a page. However it can also be very disorienting. A simple way to resolve this issue is to create a simple animation that slides down to the target section of the page, rather than jumping to it.

Position Absolute has figured out a way to do this in jQuery in 3 simple steps.

Get the source code at position-absolute.com

View a demo of the code in action

Ruby: String Manipulators

So I'm working on a feature that requires the input of a text field to be formatted in uppercase and have all spaces and dashes removed from the string.

So in the RAILS console, try:

>> a="Abs-a23-pdk 23 aB1"
=>"Abs-a23-pdk 23 aB1"
>> a.gsub!(" ", "")
=>"Abs-a23-pdk23aB1"
>> a.gsub!("-", "")
=> "Absa23pdk23aB1"
>> a.upcase!
=> "ABSA23PDK23AB1"
>> a
=> "ABSA23PDK23AB1"

Notes:
You need the "!" after the command to modify (make changes permanent) the receiver.

If you want to be fancy and write one line to do the 3 methods, try:
>> a="Abs-a23-pdk 23 aB1"
=> "Abs-a23-pdk 23 aB1"
>> a.gsub!(/[ -]/, "").upcase!
=> "ABSA23PDK23AB1"
>> a
=> "ABSA23PDK23AB1"

Notes:
So pretty much everything in between the brackets is removed is removed
[%$ _-] in this case, %, $, _, - and spaces are removed.
[1-9] in this case, all numbers are removed.

Here a link to the official documentation:
http://ruby-doc.org/core/classes/String.html

Another Link:
http://www.techotopia.com/index.php/Ruby_String_Replacement,_Substitution_and_Insertion

Monday, February 1, 2010

Javascript: Randomized Images and Script

This is a script that I found for randomizing images with links and any other bells and whistles that you want. It's by far the simplest of all the solutions that I went through.