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 | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// From all I can find on it - PSR states class methods must have opening brace on new line - not plain ol' functions // | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
function autoload($className) { | |
$className = ltrim($className, '\\'); | |
$fileName = ''; | |
$namespace = ''; | |
if ($lastNsPos = strrpos($className, '\\')) { | |
$namespace = substr($className, 0, $lastNsPos); |
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 | |
namespace AK\Monolog\Handler; | |
use Monolog\Handler\AbstractProcessingHandler; | |
use Monolog\Logger; | |
use Monolog\Formatter\JsonFormatter; | |
class PDOHandler extends AbstractProcessingHandler | |
{ |
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
#!/bin/ash | |
rm /var/log/synolog/synoconn.log | |
rm /tmp/synolog* | |
/usr/syno/etc/rc.d/S22syslogng.sh restart | |
/usr/syno/etc/rc.d/S97apache-sys.sh restart |
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 randString($length, $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-0123456789') | |
{ | |
$str = ''; | |
$count = strlen($charset) - 1; | |
while ($length--) { | |
$str .= $charset[mt_rand(0, $count)]; | |
} | |
return $str; |
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
netstat -an | grep LISTEN | awk '{ print $4 }' | rev | cut -d: -f1 | rev |
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
grunt.config(['connect'], { | |
options: { | |
port: 9000, | |
hostname: '*', | |
keepalive: true, | |
middleware: function (connect) { | |
return [ | |
function (request, response, next) { | |
response.setHeader('Access-Control-Allow-Origin', '*'); | |
return next(); |
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
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script> | |
<style> | |
/** setup simple styling **/ | |
.ng-invalid { border: 1px solid red; } | |
body { font-family: Arial,Helvetica,sans-serif; } | |
body, td, th { font-size: 14px; margin: 0; } | |
table { border-collapse: separate; border-spacing: 2px; display: table; margin-bottom: 0; margin-top: 0; -moz-box-sizing: border-box; text-indent: 0; } | |
a:link, a:visited, a:hover { color: #5D6DB6; text-decoration: none; } |
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
/** | |
* Works great on Android 4, and likely 3 but causes Android 2.3 to build a Uri | |
* with a string value of "geo:?q=" + zipCode | |
*/ | |
Uri geoUri = Uri.parse("geo:0,0?").buildUpon() | |
.appendQueryParameter("q", zipCode).build(); | |
/** | |
* Works great on Android 2.3+ | |
*/ |
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
diff addnvpair.xsl.bak addnvpair.xsl | |
19c19,26 | |
< <xsl:value-of select="normalize-space($value)"/> | |
--- | |
> <xsl:choose> | |
> <xsl:when test="@name = 'Identifier'"> | |
> <xsl:value-of select="$value"/> | |
> </xsl:when> | |
> <xsl:otherwise> | |
> <xsl:value-of select="normalize-space($value)"/> |
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 | |
$origErrorTrackVal = ini_set('track_errors',1); | |
$oldReportingLevel = error_reporting(E_ALL); //least reporting necessary is E_NOTICE | |
$mixedUnserializedVal = unserialize(($someArr['someIndex'])); | |
/** | |
* This next conditional is fun. At this point $mixedUnserializedVal can legally be any value except "unset" | |
* You still have to check the error messages though :-/ | |
*/ | |
if(isset($mixedUnserializedVal) && preg_match('/Undefined\sindex:\ssomeIndex/', $php_errormsg) === 0) { | |
//do work |
OlderNewer