Skip to content

Instantly share code, notes, and snippets.

@talbergs
talbergs / Caddyfile
Created December 12, 2016 20:16
Docker[ Caddy php7 ]
0.0.0.0:80
fastcgi / phpfmp:9000 php
@talbergs
talbergs / php_ssh_example.php
Created September 6, 2016 20:48
php ssh example
$ip = '123.12.123.123';
$user = 'root';
$pass = 'pass';
$conn = ssh2_connect($ip);
ssh2_auth_password($conn, $user, $pass);
$stream = ssh2_exec($conn, 'whoami');
stream_set_blocking($stream, true);
String.prototype.template = function(obj) {
// dot notation path getter for array and obj
function objPath(obj, path){
var arr = path.split('.');
while (arr.length && obj) {
obj = obj[arr.shift()]
if(obj === undefined) return '{undefined '+path+'}';
}
jQuery.prototype.$cache = function(xpath, name) {
if (xpath.forEach) {
xpath.forEach(function(xp){
this.$cache(xp);
}.bind(this));
} else {
!name && (name = xpath.substr(1));
this[name] = this.find(xpath)
}
return this;