no www
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
11385 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
ssh-keygen -t dsa ssh user@host 'cat >> .ssh/authorizedkeys' < .ssh/id_dsa.pub
def my_method(opts={}) {:arg_one => 'foo', :arg_two => 'two'}.merge(opts) end
def font_size_for_tag_cloud( total, lowest, highest, options={} ) return nil if total.nil? or highest.nil? or lowest.nil? # # options maxf = options.delete( :max_font_size ) || 14 minf = options.delete( :min_font_size ) || 11 maxc = options.delete( :max_color ) || [ 0, 0, 0 ] minc = options.delete( :min_color ) || [ 156, 156, 156 ] hide_sizes = options.delete( :hide_sizes ) hide_colours = options.delete( :hide_colours ) # # function to work out rgb values def rgb_color( a, b, i, x) return nil if i <= 1 or x <= 1 if a > b a-(Math.log(i)*(a-b)/Math.log(x)).floor else (Math.log(i)*(b-a)/Math.log(x)+a).floor end end # # work out colours c = [] (0..2).each { |i| c << rgb_color( minc[i], maxc[i], total, highest ) || nil } colors = c.compact.empty? ? minc.join(',') : c.join(',') # # work out the font size spread = highest.to_f - lowest.to_f spread = 1.to_f if spread <= 0 fontspread = maxf.to_f - minf.to_f fontstep = spread / fontspread size = ( minf + ( total.to_f / fontstep ) ).to_i size = maxf if size > maxf # # display the results size_txt = "font-size:#{ size.to_s }px;" unless hide_sizes color_txt = "color:rgb(#{ colors });" unless hide_colours return [ size_txt, color_txt ].join end
pop2imap --host1 westk.org --user1 rod@westk.org --password1 password --host2 orderedserver.com --user2 rod@addictedtonew.com --password2 password
module ActiveRecord class Base def self.to_select(conditions = nil) find(:all).collect { |x| [x.name,x.id] } end end end class Array def to_select self.collect { |x| [x.name,x.id] } end end
sudo apachectl restart
osascript ichatloc.scpt "This is a test"
grant all privileges on *.* to 'user'@'localhost' identified by 'password' with grant option; flush priveleges;
<cfscript> // create document document = CreateObject("java", "com.lowagie.text.Document"); document.init(); // writer fileIO = CreateObject("java", "java.io.FileOutputStream"); fileIO.init(pdf_path); writer = CreateObject("java", "com.lowagie.text.pdf.PdfWriter"); writer.getInstance(document, fileIO); document.open(); // newsinfo header image Image = CreateObject("java", "com.lowagie.text.Image"); jpg = Image.getInstance(header_image); jpg.setAbsolutePosition(28, 713); jpg.setDpi(300,300); document.add(jpg); // top margin; dumb i know but i was in a hurry paragraph = CreateObject("java", "com.lowagie.text.Paragraph"); paragraph.init(" "); for (i=0; i lt 9; i=i+1) { document.add(paragraph); } // the fonts FontFactory = createobject("java", "com.lowagie.text.FontFactory"); Font = createObject("java", "com.lowagie.text.Font"); TimesLargeBI = Font.init(Font.TIMES_ROMAN, 14.0, Font.BOLDITALIC); TimesNormal = Font.init(Font.TIMES_ROMAN, 12.0); // all the text paragraph = CreateObject("java", "com.lowagie.text.Paragraph"); paragraph.init("Hello World!", TimesLargeBI); paragraph.setIndentationLeft(indentation_left); paragraph.setIndentationRight(indentation_right); document.add(paragraph); paragraph.init("#dateFormat(now(), 'long')#", TimesNormal); paragraph.setIndentationLeft(indentation_left); paragraph.setIndentationRight(indentation_right); document.add(paragraph); document.close(); </cfscript>