Skip to content

Instantly share code, notes, and snippets.

@p0358
p0358 / any_bool_case_in_any_switch.php
Created January 4, 2018 02:17
PHP any bool case in any switch
<?php
// PHP any bool case in any switch
// useful if you want to do also some other switch case
// being exceptional result of some separate check/comparsion
//$t = 'text!';
$t = '';
$b = true; // any bool check you want in the switch, it can be inlined in the case statement too

Demo

What demos are?

A file type (with the .dem extension) containing recorded events that can be edited and played back in-game. Demos can be edited to change camera angles, speed up, slow down, play music, and other functions. (from Valve wiki)

Benefits

  • You have your every game archived once enabled. Something nice happened to game? You can always get back to it!
  • It takes way less size than a video and about no system resources compared to its recording.
@p0358
p0358 / Aaaaa.js
Last active December 17, 2019 23:28
Aaaaaaa aa aaaa aa aaaa aaaa "A" aaa "a" aaaaaaa ("A language", aaaaaaaa aAaaaa aaaa)
(function(){
// Aaa aaaaaa:
// Get all text nodes in a given container
// Source: http://stackoverflow.com/a/4399718/560114
function getTextNodesIn(node, includeWhitespaceNodes) {
var textNodes = [], nonWhitespaceMatcher = /\S/;
function getTextNodes(node) {
if (node.nodeType == 3) {