App-Cheats
view release on metacpan or search on metacpan
# Matches the last child element within the context (JQuery,Selectors,Child,Filters,Table 2.5)
:last-child
# Matches the first child element of the given type (JQuery,Selectors,Child,Filters,Table 2.5)
:first-of-type
# Matches the last child element of the given type (JQuery,Selectors,Child,Filters,Table 2.5)
:last-of-type
# Matches the nth child element, even or odd child elements, or nth child element
# computed by the supplied formula within the context based on the given parameter
# (JQuery,Selectors,Child,Filters,Table 2.5)
:nth-child(n),:nth-child(even|odd),:nth-child(Xn+Y)
# Matches the nth child element, even or odd child elements, or nth child element
# computed by the supplied formula within the context, counting from the last to
# the first element, based on the given parameter (JQuery,Selectors,Child,Filters,Table 2.5)
:nth-last-child(n),:nth-last-child(even|odd),:nth-last-child(Xn+Y)
# Matches the nth child element, even or odd child elements, or nth child element
# of their parent in relation to siblings with the same element name
# (JQuery,Selectors,Child,Filters,Table 2.5)
:nth-of-type(n),:nth-of-type(even|odd),:nth-of-type(Xn+Y)
# Matches the nth child element, even or odd child elements, or nth child element
# of their parent in relation to siblings with the same element name, counting from
#
# Deparse commands
echo "$n" | perl -MO=Deparse -nle 'sub is_prime{("N" x shift) !~ /^ (NN+?) \1+ $/x} print if is_prime($_)'
#
# Debug Regex 1
echo "$n" | perl -nle 'sub is_prime{($n)=@_; ("N" x $n) !~ /^ (NN+?) (?{ print "Trying: $n. Grouping by: $^N" }) \1+ $/x} is_prime($_); print ""'
#
# Debug Regex 2
echo "$n" | perl -Mre=debug -nle 'sub is_prime{("N" x shift) !~ /^ (NN+?) \1+ $/x} print if is_prime($_)'
# Calculate pi using the formula:
# pi = SUMMATION(x:0.5 to 0.5): 4 / (1 + x^2)
perl -le '$int = 5; $h = 1/$int; for m^C$i(1..$int){ my $x = $h * ($i - 0.5); $sum += 4 / (1 + $x**2) }; $pi = $h * $sum; print $pi'
# Example of having true value that is numerically 0.
# Documented in: perldoc perlfunc
# Can also use "0E0".
perl -wE '
$_ = "0 but true";
printf "numeric=%d, bool=%s string=%s\n",
0+$_,
# identity: log
# log_B(N) = log_e(N) / log_e(B)
# where x is the number whose logarithm you want,
# n is the desired base, and e is the natural
# logarithm base.
sub log_base {
my ($base, $value) = @_;
return log($value)/log($base);
}
# Calculate GCD and LCM using euclids formula.
perl -E '
$_m = $m = 35;
$_n = $n = 20;
while ( 1 ) {
say "$m, $n, ", ($_m * $_n / $m);
last if !$n;
($m,$n) = ($n, $m % $n);
}
'
35, 20, 20
# Excel - Simple: Generate a blank xlsx file
perl -MExcel::Writer::XLSX -E "$wb = Excel::Writer::XLSX->new('my.xlsx'); $wb->close"
# Excel - Simple: Check for errors openning an excel file and write to a cell
# Also rename the worksheet
perl -MExcel::Writer::XLSX -E "$wb = Excel::Writer::XLSX->new('my.xlsx') or die qq($!\n); $ws = $wb->add_worksheet('my'); $ws->write('A1', 'Hello Excel'); $wb->close"
# Excel - Simple: Add a format to make a cell bold
perl -MExcel::Writer::XLSX -E "$wb = Excel::Writer::XLSX->new('my.xlsx') or die qq($!\n); $ws = $wb->add_worksheet('my'); $format = $wb->add_format; $format->set_bold; $ws->write(0, 0, 'Hello Excel', $format); $wb->close"
# Create a spreadsheet/excel with formulas using perl (only on lnxbr42)
perl -MExcel::Writer::XLSX -le '
$wb=Excel::Writer::XLSX->new("new.xlsx");
$ws=$wb->add_worksheet;
$ws->write("A1","In Excel");
$ws->write("B2",3);
$ws->write("B3",4);
$ws->write("B4","=B2+B3");
$ws->write("B5","=SUM(B2:B4)");
$wb->close
'
net use k: \\path /persistent:yes
#############################################################
## Windows - Excel
#############################################################
# Get last row in an excel column
=MATCH(TRUE,INDEX($K$3:$K$22="",0),0)-1
# Show excel formulas
Ctrl + `
# Insert the current date
Ctrl + :
# Insert the current time
Ctrl + Shift + :
# Drag excel column
Ctrl + r
( run in 1.020 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )