This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// turn on signal catching | |
pcntl_async_signals(true); | |
// handler | |
$sigHandler = static function(): void { | |
// do some cleanup | |
// report to user, whatever | |
// ... | |
exit(0); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rrmdir(string $dirPath): bool { | |
array_map(static fn (string $filePath) => is_dir($filePath) ? rrmdir($filePath) : unlink($filePath), glob($dirPath . '/' . '*')); | |
return rmdir($dirPath); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\ConsoleOutputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
/** | |
* Testcase: app/console foo > std 2> err | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:airline#themes#seoul256#palette = {} | |
function! airline#themes#seoul256#refresh() | |
let M0 = airline#themes#get_highlight('Special') | |
let accents_group = airline#themes#get_highlight('Special') | |
let modified_group = [M0[0], '', M0[2], '', ''] | |
let warning_group = airline#themes#get_highlight2(['airline_warning', 'bg'], ['airline_warning', 'fg']) | |
let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['StatusLine', 'fg']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// imageValidator.js | |
'use-strict'; | |
function handleFileSelect(evt) { | |
let files = evt.target.files; // FileList object | |
// Loop through the FileList and render image files as thumbnails. | |
for (let i = 0; i < files.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// newBot.js | |
/* ##################### MODULES ####################### */ | |
let fetch = require( 'node-fetch' ); | |
let fs = require( 'fs' ); | |
let crypto = require( 'crypto' ); | |
let querystring = require( 'querystring' ); | |
/* ##################### CONSTANTS ####################### */ | |
const KEY = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xmlversion='1.0'?> | |
<xsl:stylesheet | |
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' | |
xmlns:w='http://schemas.openxmlformats.org/wordprocessingml/2006/main' | |
version='1.0'> | |
<xsl:template match="w:document/w:body/w:p/w:r/w:t[node()='Hello World']"> | |
<w:t>Goodbye World</w:t> | |
</xsl:template> | |
<!-- The following transform is the identity transform --> | |
<xsl:templatematch="/|@*|node()"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Factorial calculated with XSLT recursion. --> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
version="1.0"> | |
<xsl:output method="text"/> | |
<xsl:param name="number" select="9"/> | |
<xsl:template match="/"> | |
<xsl:call-template name="factorial"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
module namespace cust-utils = 'http://46.28.111.241:8081/exist/db/apps/karolinum-x/modules/cust-utils'; | |
(: Replace Spaces Soft – This function replaces all spaces after Czech single-letter prepositions | |
: with no-breaking spaces. Done in-memory, without storaging the result in the DB. | |
: The limitation is it does not solve double occurence, e.g. “V hlavě a v těle.“. :) | |
declare function cust-utils:replace-spaces-soft($nodes as node()*) as item()* { | |
let $match := '(^|\s| )([szkvaiouSZKVAIOU])[\s]' | |
for $node in $nodes |
NewerOlder