1 2 3 4
Gender.create([ {:name => "Male", :is_default => true}, {:name => "Female", :is_default => true} ...
Ruby Create database records
1 2 3 4
public static class DisplayHelper { [DllImport("user32.dll")] ...
C# Extend my Windows desktop o...
Enables a secondary monitor
1 2 3 4
import re def process_html(str): ...
Python Regexp extraction in Python
Is it good way to extract p...
1 2 3 4
def validate_permalink(attr_name) if permalink? permalink = sanitize_permalink(attr_name) ...
Ruby Simple if staments
easy one?
1 2 3 4
try { conn = DBConnection.getDBConnection(); String SQL = "{call PACKAGE.PROCEDURE(?, ?)}"; ...
Java Repetitive code to interact...
In my project, I do see lot...
1 2 3 4
==> functions.php <?php ...
PHP Register/Login Script
Hello People,
This websi...
1 2 3 4
# In helper def show_row(label, attribute) ...
Ruby Infer column name from inst...
Assume you have a model, li...
1 2 3 4
# Associations # # User: has_many :sources, :as => :sourceable, :dependent => :destroy ...
Ruby Get child elements from a o...
For a object (e.g. user), I...
1 2 3 4
def load_forums
case current_user.type
when "Admin"
...
ActionScript Hash generation from case
Is there easy and clever wa...
1 2 3 4
def make_verts(s, r) a = Math::PI/s b = Math::PI/(s/2) ...
Ruby Dynamic Vertices Generation
Can somebody check my math?...
1 2 3 4
public static XmlNode ViewFields { get ...
C# XmlNode creation
Very simple piece of code w...
1 2 3 4
def dedent() sRaw = self; sep = "\n"; ...
Ruby ruby dedent whitespace in a...
Remove leading whitespace f...
1 2 3 4
this.rotate = function (antiClockwise) { if (antiClockwise) ...
JavaScript Rotate co-ordinates
A nice and fun one here. I ...
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-...
the string can contain 1-n ...
1 2 3
function matches(matchString,list) ...
JavaScript Search a string with wildcards
I want to have a string whi...
1 2 3 4
public partial class Attivazioni { public byte[] CodiceRichiesta ...
C# Properties surrounding arra...
Is there a better way to su...
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...
Hi, I'm currently using Bin...
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...
I'm wrapping an API in ruby...
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
I wrote the following to ge...
1 2 3 4
class String def squish x = 0 ...
Ruby Function to remove consiste...
The code doesn't feel elega...
1 2 3 4
rightOffset = 20; topOffset = 20; ...
JavaScript Center text along a sloping...
I've written a countdown to...
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
There are certain libraries...
1 2 3 4
<? //Fonksiyon: Ertuğrul Erkan function yazial($adres1) { ...
PHP wordpress bot making
<a href="http://www.oynatsa...
Can't we create first all r...