Skip to content

Instantly share code, notes, and snippets.

@saitonakamura
saitonakamura / fixCircular.js
Last active October 27, 2021 03:29
Function that replace circular js object dependency with "[Circular]" so it can be consumed by JSON.stringify
// DISCLAIMER
// Original function was updated to a faster and es5-supporting version by @Quacky2200
var replaceCircular = function(val, cache) {
cache = cache || new WeakSet();
if (val && typeof(val) == 'object') {
if (cache.has(val)) return '[Circular]';
@denyago
denyago / README.md
Last active April 12, 2021 11:52
Screencast from Android

Screancasting from Android

There are 2 ways to capture video streams, but both have the same source adb shell screenrecord.

Important: device must be POWERFULL!

This will use "Raw frames". It can wait for user to continue

adb shell screenrecord --size=360x640 --output-format=raw-frames - | mplayer -demuxer rawvideo -rawvideo w=360:h=640:format=rgb24 -
@odan
odan / xampp_php7_xdebug.md
Last active April 17, 2024 05:36
Installing Xdebug for XAMPP
@smichaelsen
smichaelsen / check_regex.php
Last active November 2, 2021 13:12
PHP: Check if string is valid regular expression
<?php
function isRegularExpression($string) {
set_error_handler(function() {}, E_WARNING);
$isRegularExpression = preg_match($string, "") !== FALSE;
restore_error_handler();
return isRegularExpression;
}
@mdeous
mdeous / repermute.py
Created February 13, 2012 16:04
generate all possible permutations of a regex
# -*- coding: utf-8 -*-
#
# Used like this:
#
# from repermute import ipermute
#
# for s in ipermute('[A-Z]\d'):
# print s
#
# Almost all regular expression constructs are supported except for '*'