1
2
3
4
Gender.create([
  {:name => "Male", :is_default => true},
  {:name => "Female", :is_default => true}
...

Ruby Create database records

by nimeshnikum.myopenid.com, March 18, 2010 11:33, 1 refactoring, tagged with speed rails activerecord rails ruby sql

Can't we create first all r...

Bc572b4652b1df3ea13619423acd6127 Talk
1
2
3
4
public static class DisplayHelper
{
	[DllImport("user32.dll")]
...

C# Extend my Windows desktop o...

by loraderon.myopenid.com, March 17, 2010 13:56, No refactoring, tagged with windows, win32

Enables a secondary monitor

682a9ec8802319caf27eadd7666ae6e3 Talk
1
2
3
4
import re

def process_html(str):
...

Python Regexp extraction in Python

by rullon.myopenid.com, March 17, 2010 10:22, 4 refactorings, tagged with python, regexp

Is it good way to extract p...

Avatar Talk
1
2
3
4
  def validate_permalink(attr_name)
    if permalink?
      permalink = sanitize_permalink(attr_name)
...

Ruby Simple if staments

by rgoytacaz.myopenid.com, March 16, 2010 01:23, 3 refactorings, tagged with if else

easy one?

9fe77a0217c77ce4cb00096d863c8b45 Talk
1
2
3
#!/usr/bin/env ruby

...

Ruby Sort photos into folders on...

by deepspring.myopenid.com, March 15, 2010 19:07, 1 refactoring, tagged with ruby, sort, photos

Basically, I have a large n...

Avatar Talk
1
2
3
4
try {
	conn = DBConnection.getDBConnection();
	String SQL = "{call PACKAGE.PROCEDURE(?, ?)}";
...

Java Repetitive code to interact...

by shamikm78.myopenid.com, March 15, 2010 17:57, 1 refactoring, tagged with java, JDBC

In my project, I do see lot...

Avatar Talk
1
2
3
4
==> functions.php 

<?php
...

PHP Register/Login Script

by penaf.myopenid.com, March 12, 2010 23:45, 13 refactorings, tagged with login, register, mysql, php

Hello People,

This websi...

84c8afb06eeacbf350b5b42cb795f195 Talk
1
2
3
4
# In helper

def show_row(label, attribute)
...

Ruby Infer column name from inst...

by Josh, March 11, 2010 20:18, 1 refactoring, tagged with rails activerecord, models

Assume you have a model, li...

37d67924a83f566ba8220348a3e9bedb Talk
1
2
3
4
# Associations
#
# User: has_many :sources, :as => :sourceable, :dependent => :destroy
...

Ruby Get child elements from a o...

by Chris, March 11, 2010 08:27, No refactoring, tagged with model, assoziations, activerecord, rails activerecord

For a object (e.g. user), I...

5d7c8b8f2de06c07b2bf0848d20ce71f Talk
1
2
3
4
def load_forums                         
    case current_user.type
      when "Admin"
...

ActionScript Hash generation from case

by penkinv.myopenid.com, March 09, 2010 15:31, No refactoring, tagged with case conditions

Is there easy and clever wa...

3989eecb0a59c9374f3c25a0821e0ea5 Talk
1
2
3
4
def make_verts(s, r)
  a = Math::PI/s
  b = Math::PI/(s/2)
...

Ruby Dynamic Vertices Generation

by slf, March 08, 2010 22:46, 2 refactorings, tagged with ruby math

Can somebody check my math?...

098e5c1a565b47e9860539fbebc3fa98 Talk
1
2
3
4
public static XmlNode ViewFields
{
  get
...

C# XmlNode creation

by Robert, March 06, 2010 13:36, 1 refactoring, tagged with xmldocument

Very simple piece of code w...

Bf2af16812228b5a54daeb30c96efaf2 Talk
1
2
3
4
        def dedent()
            sRaw    =   self;
            sep     =   "\n";
...

Ruby ruby dedent whitespace in a...

by dreftymac.myopenid.com, March 05, 2010 16:37, 2 refactorings, tagged with ruby, string, monkeypatch

Remove leading whitespace f...

Avatar Talk
1
2
3
4
this.rotate = function (antiClockwise)
{
  if (antiClockwise)
...

JavaScript Rotate co-ordinates

by Nathan, March 05, 2010 15:49, 4 refactorings, tagged with co-ordinates, rotate, matrix

A nice and fun one here. I ...

D5145c421cd25af6fa577c15219add90 Talk
1
2
3
4
def hash_from_string(string, value)
  hash, split = {}, string.split(".")
  (split.size-1).downto(0) do |i|
...

Ruby Nested Hash from delimiter-...

by rubiii, March 04, 2010 21:38, 4 refactorings, tagged with ruby, functional

the string can contain 1-n ...

61d580cc983d52f3dc5050a6858fc788 Talk
1
2
3
function matches(matchString,list)
...

JavaScript Search a string with wildcards

by Nathan, March 03, 2010 00:48, 5 refactorings

I want to have a string whi...

D5145c421cd25af6fa577c15219add90 Talk
1
2
3
4
public partial class Attivazioni
{
            public byte[] CodiceRichiesta
...

C# Properties surrounding arra...

by marcomangia.myopenid.com, March 02, 2010 13:45, 1 refactoring, tagged with array byte property

Is there a better way to su...

87bb826b11aa8dc35bcc7436043e0f7e Talk
1
2
3
4
File.open( "binary.bin", "wb" ) do |io|
  obj = BinData::String.new(:initial_value => "Binary file start-point").write(io)      
  obj = BinData::Uint32be.new(:initial_value => 0).write(io)
...

Ruby Creating a binary file with...

by podcaster, March 01, 2010 12:14, 3 refactorings, tagged with binary, ruby, io, bindata

Hi, I'm currently using Bin...

13d7a3ab12ec57e0d372d7115362cb91 Talk
1
2
3
4
    def flights_by_airline(airline_id, flight_number=nil, date=nil, params={})
      if flight_number && date
        t = convert_date(date)
...

Ruby Better way to offer several...

by jarodluebbert.myopenid.com, March 01, 2010 08:21, 3 refactorings, tagged with api, ruby, parameters

I'm wrapping an API in ruby...

3a5f66f6c3feb6092d375c3e145de0d4 Talk
1
2
3
4
tl = Time.now.localtime
(0..356).each {|i| d =  (Date.new(tl.year, tl.month, tl.day) +i );
 printf("\n%03s\n\n", Date::ABBR_MONTHNAMES[d.month]) if d.day == 1;
...

Ruby Generate Days of a Year

by gregelin.myopenid.com, February 27, 2010 15:51, 2 refactorings, tagged with short

I wrote the following to ge...

57f954ba5409a6504af785ed8d42e009 Talk
1
2
3
4
class String
  def squish
    x = 0
...

Ruby Function to remove consiste...

by mxcl, February 27, 2010 15:01, 3 refactorings

The code doesn't feel elega...

25ff3dfe48d3847ecf9971aab99589fb Talk
1
2
3
#!/usr/bin/perl
...

Perl Restructuring Perl Sitemap ...

by tiekuhn, February 27, 2010 10:24, 1 refactoring, tagged with perl sitemap structure

I recently rewrote my Ruby ...

175ab087b0647367da3d370fbf5bc024 Talk
1
2
3
4
rightOffset = 20;
topOffset = 20;
               
...

JavaScript Center text along a sloping...

by Nathan, February 26, 2010 23:46, 1 refactoring

I've written a countdown to...

D5145c421cd25af6fa577c15219add90 Talk
1
2
3
4
// this is a function that creates with_libraryname functions
var lazy_load_library = function (path) {
	return function () {
...

JavaScript Lazy Library Loading

by raganwald, February 26, 2010 22:31, 2 refactorings, tagged with javascript, jquery, jgesture, periodicalupdater, lazy loading, lazy evaluation

There are certain libraries...

Fd0d54f1856a8c9cc03f2e5de7c4bc6d Talk
1
2
3
4
<?
//Fonksiyon: Ertuğrul Erkan
function yazial($adres1) {
...

PHP wordpress bot making

by saydax.myopenid.com, February 26, 2010 20:29, No refactoring, tagged with kiz oyunları, barbie oyunları

<a href="http://www.oynatsa...

Avatar Talk