Download vCard

vcard

Tell when it is Christmas time

Written in PHPAdded on Dec 24 2009 at 1:08 AM
<?php

## Function
function christmas_time() {
	$time = date("m-d");
	$time = explode("-", $time);
	
	if ($time[0] == 12 && ($time[1] >= 20 
...
View entire snipit


Restrict user based on IP Address

Written in PHPAdded on Jan 16 2010 at 12:57 PM
<?php
function ip_allow($ipaddress = null) {
	
	/**
	* Get user ip address 
	* assign ipaddress to variable $ip
	*/
	if ($ipaddress == null)
...
View entire snipit


Do logarithm with base other than 10

Written in RubyAdded on Apr 26 2010 at 12:37 PM
def spclog(base, range, exp = 1)
  answer = Math.log10(range) / Math.log10(base)
  
  answer = answer**exp
end

puts spclog(2, 4) # => nil >> 2.
...
View entire snipit


Random string

Written in PerlAdded on Aug 22 2010 at 5:37 PM
#!/usr/bin/perl -w
use strict;

print &randstr(64);

sub randstr {
	my $length = shift @_;
	$length ||= 10;
	my @chars = split //, "ABCDEFGopq
...
View entire snipit