sub test(Int $a) { say $a + 3 }
test(23); # 26
sub test(Int $a) { say $a + 3 }
test("23"); # Calling 'test' will never work with argument types (str) (line 1)
# Expected: :(Int $a)
// My Promisable's library provides two forms of use, one looks mostly like typical promises/A+ a'la Q and bluebird. | |
// The other looks more like callbacks. This gist shows examples of the two that are semantically equivalent. | |
// In practice, you wouldn't normally chain Promisables in the callback style to connect success and error handlers the way | |
// you do with the promises with then/catch/finally. | |
Assuming: | |
var Promisable = require('promisable'); | |
Then: | |
.then(function(V){ … }) |
use strict; | |
use warnings; | |
use Benchmark; | |
use List::MoreUtils qw(minmax uniq part); | |
use Test::More tests => 1; | |
my @set; push @set, int(rand()*1000) for 1..10_000; | |
my $pivot_a = 333; | |
my $pivot_b = 666; |
sub test(Int $a) { say $a + 3 }
test(23); # 26
sub test(Int $a) { say $a + 3 }
test("23"); # Calling 'test' will never work with argument types (str) (line 1)
# Expected: :(Int $a)
// Callback form | |
"use strict"; | |
var sqldb = require('sqldb'); | |
sqldb.connect('mysql',{dbname:'test',user:'root'},function(e,dbh){ | |
if (e) throw e; | |
dbh.prepare('SELECT :bar as world',function(e,sth){ | |
if (e) throw e; | |
sth.param('bar','Hello'); | |
sth.execute(function(e,rows){ |
<? | |
/** | |
* twitterfeed.php | |
* | |
* A single file script which serves an authenticated personal Twitter timeline as an Atom feed. | |
* | |
* To use: | |
* 1) Go to https://dev.twitter.com/apps and create a new App | |
* 2) Use the Authentication button to create the tokens/secrets needed | |
* 3) Copy the results into the appropriate spots below |
ModyllicSQL is our platonic ideal SQL schema, and a moving target as we integrate more interesting features from various databases. It begins life as a full-metadata dialect of MySQL with a few minor extensions already documented.
Dialect specific parsers, eg, when loading directly from a database, generate a dialect specific schema.
Prior to dumping, if the schema is not yet dialect specific, it will be mutated to be so.
if ($racks =~ /\D/) { | |
print "\n$racks isn't a positive integer at all!\n\n"; | |
exit; | |
} | |
for (; $racks >= 2; $racks--) { | |
&length; | |
} |
Console_ProgressBar | |
Console_ProgressBar displays a customizable progress bar in the console/terminal. | |
http://pear.php.net/manual/en/package.console.console-progressbar.php | |
Some progress bar examples | |
This will display a very simple bar: | |
===================================================== |