This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.
28 06, 2009

unpack

By | 2009-07-02T14:45:30+00:00 June 28th, 2009|Categories: PHP, Ruby|Tags: , , , , |Comments Off on unpack

The unpack function decodes a binary string into an array according to the format given as a parameter.

PHP

$binary_string = pack("nvc*", 0x1234, 0x5678, 65, 66);
$array = unpack("nvc*", $binary_string);

Ruby

a = [0x1234, 0x5678, 65, 66];

binary_string = a.pack("nvc*");

my_array = binary_string.unpack('nvc*');
25 06, 2009

pack

By | 2009-07-02T14:39:12+00:00 June 25th, 2009|Categories: PHP, Ruby|Tags: , , , , , |Comments Off on pack

The pack function packs the given arguments into a binary string according to format provided as a parameter.

PHP

$binary_string = pack("nvc*", 0x1234, 0x5678, 65, 66);

Ruby

a = [0x1234, 0x5678, 65, 66];

binary_string = a.pack("nvc*");
22 06, 2009

bin2hex

By | 2009-06-24T13:35:42+00:00 June 22nd, 2009|Categories: PHP, Ruby|Tags: , , , , , |Comments Off on bin2hex

The bin2hex function converts any string into an ASCII string containing the hexadecimal represenation of the original string. As the name of the function suggests, bin2hex is particularly useful to make a human-readable representation of binary strings.

PHP

$binary_string = pack("nvc*", 0x1234, 0x5678, 65, 66);

echo bin2hex($binary_string);

=> // 123478564142

Ruby doesn’t have a function equivalent to PHP’s bin2hex, but Bytes::unpack with a format string of H* will achieve the same functionality.

Ruby

a = [0x1234, 0x5678, 65, 66];

binary_string = a.pack("nvc*");

puts binary_string.unpack('H*');
=> # 123478564142
19 06, 2009

rtrim

By | 2009-06-18T15:32:19+00:00 June 19th, 2009|Categories: PHP, Ruby|Tags: , , , , , , |Comments Off on rtrim

The rtrim function strips whitespace (or other characters) from the end of a string.

PHP

echo rtrim('Work Hard. Play Harder.', ' Play Harder.');
=> // 'Work Hard.'

Ruby

substitute = 'Play Harder.';

puts "Work Hard. Play Harder.".gsub(/[#{substitute}]+$/, '')
=> # 'Work Hard.'
16 06, 2009

ltrim

By | 2009-06-18T15:26:12+00:00 June 16th, 2009|Categories: PHP, Ruby|Tags: , , , , , , |Comments Off on ltrim

The ltrim function strips whitespace (or other characters) from the beginning of a string.

PHP

echo ltrim('John and I love icecream', 'John and ');
=> // 'I love icecream'

Ruby

substitute = 'John and ';

puts "John and I love icecream".gsub(/^[#{substitute}]+/, '')
=> # 'I love icecream'
13 06, 2009

trim

By | 2009-06-12T17:26:40+00:00 June 13th, 2009|Categories: PHP, Ruby|Tags: , , , , , , |Comments Off on trim

The trim function is mainly used to remove whitespace from the beginning and end of strings, although it can be used to remove other characters too.

PHP

echo trim("  Hello World  ");
=> // 'Hello World'

Ruby

puts "  Hello World  ".strip
=> # 'Hello World'

The trim() function can also take a second argument which allows the removal of an arbitrary character.

PHP

echo trim("\n\nHello World\n\n", "\n");
=> // 'Hello World'

Ruby

substitute = '\n';
puts "\n\nHello World\n\n".gsub(/^[#{substitute}]+|[#{substitute}]+$/, '')
=> # 'Hello World'
10 06, 2009

chr

By | 2009-06-03T09:34:41+00:00 June 10th, 2009|Categories: PHP, Ruby|Tags: , , , |Comments Off on chr

The chr function returns a one-character string, which represents the character specified by an ASCII code.

PHP

echo chr(115);
=> // s

Ruby

puts 115.chr
=> # s
7 06, 2009

chown

By | 2009-06-03T09:22:25+00:00 June 7th, 2009|Categories: PHP, Ruby|Tags: , , , , , |Comments Off on chown

The chown function is used to change the owner of a specific file or directory.

PHP

chown('/home/ruby/file.php', 'john');

Ruby

require 'fileutils';

FileUtils.chown('john', nil, '/home/ruby/file.php');
4 06, 2009

chmod

By | 2009-06-02T15:39:34+00:00 June 4th, 2009|Categories: PHP, Ruby|Tags: , , , , |Comments Off on chmod

The chmod function is used to change the permissions (or mode) on a specific file or directory.

PHP

chmod('/home/ruby/file.php', 0777)

Ruby

File.chmod(0777, '/home/ruby/file.php')
1 06, 2009

implode

By | 2009-10-15T22:42:21+00:00 June 1st, 2009|Categories: PHP, Ruby|Tags: , , , , |Comments Off on implode

The implode function takes and array and forms a string by concatenating the elements in the array.

PHP

$langs = array('python', 'java', 'ruby');
$string = implode(', ', $langs);
echo $string;
// => python, java, ruby

Ruby

puts ['perl', 'python', 'java'].join(', ');
# => python, java, ruby