App-Cheats

 view release on metacpan or  search on metacpan

cheats.txt  view on Meta::CPAN

#############################################################
## Linux Commands - curl
#############################################################

# View the heading of a server response
curl --head www.google.com

# Check if website/URL is up (Jira,ping)
curl -s --head http://localhost:8081/secure/Dashboard.jspa | head -1

# Download files using curl and validate the checksum:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert.sha256"
echo "$(cat kubectl-convert.sha256) kubectl-convert" | sha256sum --check
#
# Install the new command.
sudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert


#############################################################
## Linux Commands - cut

cheats.txt  view on Meta::CPAN

//
window.addEventListener('load', function() {
  alert("All done");
}, false);
//
child.addEventListener("click", second);
parent.addEventListener("click", first, true);
when clicking child element, first method will be called before second.

# Add a function to an event (HTML Event Listener)
is_no_automatic_change.addEventListener("change", validate_general_tab_checks);
document.querySelector("input[name=NAME]").addEventListener("change", myFunc)

# Remove a function from an event (HTML Event Listener)
document.querySelector("input[name=NAME]").removeEventListener("change", myFunc, false)

# Check if an event is set (HTML Event Listener)
getEventListeners(document.querySelector("input[name=NAME]")).change


#############################################################

cheats.txt  view on Meta::CPAN

1 �
perl -C -Mutf8 -E '$s = "é"; say length($s) . " $s"'
1 é


#############################################################
## Perl Modules - Business::CreditCard
#############################################################

# Validate a credit card number.
perl -MBusiness::CreditCard -E 'say validate("5276 4400 6542 1319")'
1
#
perl -MBusiness::CreditCard -E 'say cardtype("5276 4400 6542 1319")'
MasterCard


#############################################################
## Perl Modules - charnames
#############################################################

cheats.txt  view on Meta::CPAN

# Persistent cache using Memoize::Storable


#############################################################
## Perl Modules - Modern::Perl
#############################################################

# Modern::Perl defaults to v5.12 (bug!?)
perl -E 'say $^V'
v5.36.0
perl -Modern::Perl -e 'say Modern::Perl::validate_date(2022)'
:5.34
perl -Modern::Perl -e 'say Modern::Perl::validate_date()'
:5.12
perl                    -E 'sub abc ($n) {$n}'
perl -Modern::Perl=2022 -e 'sub abc ($n) {$n}'
perl -Modern::Perl      -e 'sub abc ($n) {$n}'
Illegal character in prototype for main::abc : $n at -e line 1.
Global symbol "$n" requires explicit package name (did you forget to declare "my $n"?) at -e line 1.
Execution of -e aborted due to compilation errors.


#############################################################

cheats.txt  view on Meta::CPAN

perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack(-fill => "both", -expand => 1); @pgs = map { $nb->add("page$_", -label => "Page $_") } 0..10; $nb->pagecget("page0", "-state"); $pgs[0]->Button(-text => "Button $_")->pack(-fill => "bo...

# Notebook example 5. multiple pages/tabs (PTk)
# 2 rows
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack(-fill => "both", -expand => 1); $nb->add("page0$_", -label => "Page $_") for 1..5; map { my $nb = $_; $nb->add("page1$_", -label => "Page $_") for 6..10;   } map $_->NoteBook->pack, ma...

# Notebook example 6. multiple pages/tabs (PTk)
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack; $nb->add("page0$_", -label => "Page $_") for 1..5; @pgs = map $nb->page_widget($_), $nb->pages; ($p,@rest)=@pgs; $nb1=$p->NoteBook->pack; $nb1->add("page1$_", -label => "Page $_") for...

# Entry widget validation options (PTk)
perl -MTk -le 'MainWindow->new->Entry(-validate => "key", -validatecommand => sub{$_[1] =~ /\d/}, -invalidcommand => sub{ print "ERROR" })->pack->focus; MainLoop'

# Making Scrollbars (PTk)
# When text widget is scrolled its "-yscrollcommand" command is invoked. This calls $s->set(...)
# When the scrollbar is clicked on "-command" is invoked which calls $t->yview(...)
perl -MTk -le '$mw=MainWindow->new; $s=$mw->Scrollbar; $t=$mw->Text(-yscrollcommand => ["set" => $s]); $s->configure(-command => ["yview" => $t]); $s->pack(-side => "right", -fill => "y"); $t->pack(-fill => "both"); MainLoop'

# Scale widget example (PTk)
perl -MTk -le 'MainWindow->new->Scale(-from => 1, -to => 5, -tickinterval => 1, -showvalue => 0)->pack; MainLoop'

# Balloon widget example (PTk)



( run in 0.648 second using v1.01-cache-2.11-cpan-a5abf4f5562 )