View PHP - finding escaped backslashes
<?php | |
/* This handy script lets you locate escaped backslashes in the prettiest way. */ | |
$input = $_POST['value']; | |
$matches = array(); | |
if (preg_match("/\\\\/", $input, $matches)) { | |
var_dump($matches); | |
} else { |
View lol.js
(function($) { | |
$.fn.lol = function() { | |
var scope = function($this) { | |
var f = { | |
/** | |
* The "constructor" | |
*/ | |
init : function() { | |
console.log('init'); |
View lol.php
<?php | |
$lol = null; | |
$$lol->enabled = true; | |
var_dump($$lol); | |
var_dump($lol); | |
/* Output: | |
PHP Strict Standards: Creating default object from empty value in /Users/ibmurai/lol.php on line 4 |
View php-log-highlight.php
#!/usr/bin/php | |
<?php | |
/** | |
* Usage: tail -f /var/log/apache2/error.log | php-log-highlight | |
*/ | |
ini_set('display_errors', E_ALL & ~E_STRICT); | |
// Dependencies | |
require_once 'Console/Color.php'; |
View fixstuff.php
#!/opt/local/bin/php | |
<?php | |
function getDirectoryList($dir, $skipExtensions = []) { | |
$dirList = $fileList = []; | |
if ($dfp = opendir($dir)) { | |
while (($entry = readdir($dfp)) !== false) { | |
$skip = false; | |
foreach ($skipExtensions as $extension) { | |
if (substr($entry, strlen($entry) - strlen($extension)) === $extension) { |
View docker-sweep.sh
#!/bin/bash | |
docker rm $(docker ps -aq --filter status=exited) | |
docker rmi $(docker images -f "dangling=true" -q) |
View docker-clean.sh
#!/bin/bash | |
docker stop $(docker ps -aq --filter status=running) | |
docker rm $(docker ps -aq) | |
docker rmi $(docker images -q) |
View lol.sh
#!/bin/bash | |
if [ $(curl -s -H "Accept: application/json" https://tvtid-backend.tv2.dk/tvtid-app-backend/schedules/channels | grep "{},") ]; then | |
echo "It's bad!!" | |
else | |
echo "It's good!" | |
fi |
View tv2e.fish
function tv2e | |
switch "$argv" | |
case 'a' | |
echo "playfe" | |
case 'b' | |
echo "is" | |
case 'c' | |
echo "cms" | |
case 'd' | |
echo "app" |