Weighted random selection
11
inxilpro
This is a simple script to generate a random alphanumeric string.
5
IP2Location is a Ruby library that enables the user to find the country, region, city, coordinates, zip code, ISP and domain name that any IP address or hostname originates from. It has been optimized for speed and memory utilization. Developers can use the API to query all IP2Location™ binary databases for applications written in C or supporting static/dynamic library.
1
A quick implementation of an encrypter which can't be cracked by frequency analysis.
1
The decrypter for the simple encrypter I posted earlier - Takes the encrypted text from a text file - "encrypt.txt" which the encrypter automatically writes to.
1
A simple algorithm to convert decimal numbers to binary; pointless since most languages have an inbuilt function but was used for learning about algorithm design.
1
From time to time you may have reasons to override the default find method that ActiveRecord provides. In this example, we'll store a side-copy of the record attributes so that we have some basis for discovering changes to the data.
note: this will not override dynamic finders such as find_by_id
note: this will not override dynamic finders such as find_by_id
8
When doing a lot of testing in script/console, you often have to reload to pickup changes in DB schema, models and libs. The process of quitting the console and restarting it can become incredibly tedious amidst bugtracking.
note: I don't believe this reloads items in the libs dir
note: I don't believe this reloads items in the libs dir
5
I'm in the process of writing test fixtures for our rails site. A lot of my tests require authentication, so I've had to port our permissions system into a fixture. Rather than type out all of the information for the fixture, I decided to create a nested loop that will take care of this for me.
There's probably a rake task for this, but I wasn't able to find it, so I came up with my own solution. You'll have to do a little cleanup when it's done, however some slight mods to this loop could even eliminate that.
There's probably a rake task for this, but I wasn't able to find it, so I came up with my own solution. You'll have to do a little cleanup when it's done, however some slight mods to this loop could even eliminate that.
-1
The method 'removeDoubles' uses a HashSet to remove double elements from a list without creating another list. The first occurrences of the multiple elements are kept, others will be removed. The order of the list will be preserved. The parameter list's iterator must support remove. Example of use is given in the main-method.
5
A very simple script to generate random hexa colors.
just modify line 36 to generate more/less colors.
just modify line 36 to generate more/less colors.









