1 2 3 4
def test_web_browser() if request.env["HTTP_USER_AGENT"][/Firefox\/3/]=="Firefox/3" return "Firefox3" ...
Ruby Code to detect the web browser
by dcadenas.blogspot.com,
August 28, 2008 17:19,
9 refactorings
1 2 3 4
<?php class PropertyHandler { ...
PHP Base class for easy class p...
This class lets you handle ...
1 2 3 4
try: if options.input_file: infile = open(options.input_file, 'r') ...
Python Your average file filter...
by agnul,
August 27, 2008 17:22,
2 refactorings
From the useless speculatio...
1 2 3 4
data = data.gsub("\xA0", " ") data = data.gsub("\x99", "(TM)") data = data.gsub("\x97", "-") ...
Ruby simplify multiple gsub
I could put the search/repl...
1 2 3 4
#!/usr/bin/python # -*- coding: utf-8 -*- ...
Python Parse XML from Yahoo weathe...
Is there a more efficient w...
1 2 3 4
#!/usr/bin/python # -*- coding: utf-8 -*- ...
Python Base64 image encoding and i...
Is this a correct a way to ...
1 2 3 4
#!/usr/bin/python # -*- coding: utf-8 -*- ...
Python Query TinyUrl the fastest way
I'm looking for the fastest...
1 2 3
...
Ruby Link to if else simple cond...
by DG,
August 20, 2008 09:43,
4 refactorings
Hi,
Are there any other ...
1 2 3 4
class Test @@tries=0 attr_reader :num ...
Ruby Code transactions
In a Rails controller I'm s...
1 2 3 4
public static int[] zigzagify(int[] array, int xmax, int ymax) { int[] zz = new int[array.length]; //zigzag array if (array.length != xmax * ymax) { ...
Java Zig Zag ordering of array
This is the code that is su...
1 2 3 4
#!/usr/bin/env python # -*- coding: utf-8 -*- ...
Python Get function's attributes
I bet there is some other, ...
1 2 3 4
def ask_words array = [] puts 'Enter words, blank row quits.' ...
Ruby Method for sorting
This is exercise from Chris...
1 2 3 4
<% if @favorite_flag %> <div class="float-l-r" > ...
Ruby simple link_to_remote if el...
by DG,
August 19, 2008 11:35,
2 refactorings
Hi,
- In following code sn...
1 2 3
<%if @user.city.blank?%>
...
Ruby Default value for user column
by DG,
August 19, 2008 08:57,
5 refactorings
Hi,
- In users table city ...
1 2 3 4
public static String getRelativePath(File file, File relativeTo) throws IOException { /* * windows seems in some cases not to stop getParent() at 'c:\', which I ...
Java get path of a File relative...
I call:
File f = new File(...
1 2 3 4
//msg is the string to show in the alert. //obj is the input to focus function msgFocus(msg, obj){ ...
JavaScript Setting focus after alert
I don't know why, after an ...
1 2 3 4
public static boolean fileContentsEquals(File file1, File file2) { InputStream is1 = null; InputStream is2 = null; ...
Java fileContentsEquals
This method checks if the c...
1 2 3 4
<?php class RequestFile ...
PHP Universal File Download Class
by Chris Dean,
August 16, 2008 11:21,
3 refactorings, tagged with php, 5, universal, file, download, class
After finding different hos...
1 2 3 4
def html_truncate(text, length = 30, options = {}) options.merge!(:break_on_word => true) unless options[:break_on_word] truncate_string = options[:truncate_string] ? options[:truncate_string] : "..." ...
Ruby ruby html_truncate
by roym,
August 15, 2008 07:49,
1 refactoring
This is a rewrite of rails ...
1 2 3 4
def fix_send_to_array(array) a = array.split(',') ...
Ruby CSV turn in to an array of ...
Hello all,
I am trying to ...
This is not my code but I w...