Skip to content

Instantly share code, notes, and snippets.

ecarroll@x60s:~$ php -a
Interactive shell
php > $comp_me = gzcompress('Compress me', 9);
php >
php > parse_str( 'var='. urlencode( $comp_me ) );
php >
php > var_dump( urlencode($var) );
string(42) "x%DAs%CE%CF-%28J-.V%C8M%05%5C0%19%BD%04%3F"
php > var_dump( urlencode( $comp_me ) );
package DM::Model::Types::Overload;
use mro 'c3';
use overload;
use feature ':5.10';
sub unoverload {
die "$_[0] Not an object that is overloaded"
if !overload::Method( $_[0], '""' )
;
@EvanCarroll
EvanCarroll / ex.cs
Created July 18, 2009 22:02
C# - sohws the effect of virtual/overide vs new
using System;
namespace ConsoleView
{
public class Base {
public virtual void View() {
Console.WriteLine("Viewing Base, Original virtual View");
}
public void ViewNew() {
Console.WriteLine("Viewing Base, Original OLD ViewNew ;)");
## You can do this:
<?php
class foo {
function test() {
?>
Hello!
<?php
}
}
$test = new foo();
The errors in error.txt resulted from having written a storedproc, when I wanted to write
a user-defined scalar function. The problem, and solution are named appropriately in
this archive.
#!/usr/bin/env perl
package AleenaCode;
use warnings;
use strict;
use Sub::Exporter -setup => { exports => [qw/
random_color HTML_color random_color_with_key
get_totally_random_color
/] };
#!/usr/bin/env perl
use strict;
use warnings;
use feature ':5.10';
use LWP::UserAgent;
use HTML::TreeBuilder;
my $ua = LWP::UserAgent->new;
#!/usr/bin/perl
use feature ':5.10';
use warnings;
use strict;
my %saving_throws = (
ppd => [qw(paralyzation poison death_magic)],
rsw => [qw(rods staves wands)],
pp => [qw(petrifaction polymorph)],
bw => [qw(breath_weapon)],
sub _sort {
no strict;
my %h;
for my $a_or_b ( qw/ a b / ) {
say "$a_or_b: \t $$a_or_b";
given ( $$a_or_b ) {
when ( 'vin' ) { $h{$a_or_b} = -50 }
when ( 'stock' ) { $h{$a_or_b} = -49 }
when ( 'is_new' ) { $h{$a_or_b} = -48 }
$RFC822PAT = <<'EOF';
[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\
xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xf
f\n\015()]*)*\)[\040\t]*)*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\x
ff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015
"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\
xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80
-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*
)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\
\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\