Overriding ActiveRecord's find method
4
berkeley_mikeg
I have created this sippet because I VPN into work to check problems or e-mail and had to change my IE settings to surf the internet. With this sippet, once configured will allow you to override your internet explorer proxy settings to connect and browse the internet with one double click of the mouse or as I have done, add it to my VPN profile auto starter and it reconfigures my internet browser after i'm connected.
(this will shut the browser if it's running, make the changes and launch it with the changed configuration)
(this will shut the browser if it's running, make the changes and launch it with the changed configuration)
0
Celebhir
This function takes a directory, and a "folder" search parameter.
If it finds the directory (either in single level, or any sub folder) it will return the relative path of that folder. "FALSE" if not found. Skips over files and "." and ".." directories. Recursive by default.
If it finds the directory (either in single level, or any sub folder) it will return the relative path of that folder. "FALSE" if not found. Skips over files and "." and ".." directories. Recursive by default.
0
Usage:
found('asdf',@array);
P.S. In perl 5.10 can be written as
use 5.010;
'asdf'~~@array;
found('asdf',@array);
P.S. In perl 5.10 can be written as
use 5.010;
'asdf'~~@array;
1
By default, migrations will run on the development environment. Here's how you would specify another environment.
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.
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.









