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
# As-seen-at https://asked.io/jquery-json-post-form-data | |
$.fn.postJson = function(success) { | |
return this.each(function() { | |
$(this).on('submit', function(){ | |
$.post( $(this).data('action'), $(this).serialize(), success, "json"); | |
return false; | |
}); | |
}); | |
}; |
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
module Sinatra::Hi | |
module Helpers | |
def conf | |
@page_title = 'Hi :D' | |
end | |
end | |
def self.registered(app) | |
app.helpers Helpers |
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 | |
class SSH{ | |
var $host=''; | |
var $port=''; | |
var $user=''; | |
var $pass=''; | |
var $connection=''; | |
var $sudo=''; | |
var $authed=false; |
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 | |
$failed=true; | |
if($site=file_get_contents('http://google.com')){ | |
if(preg_match('/google/', $site)) $failed=false; | |
# Maybe your sites online but has an error.. | |
# if(preg_match('/Something went wrong/', $site)) $failed=true; | |
} | |
if($failed) mail('you @ tld.com', 'Site OFFLINE', 'WTF dude!'); |
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 | |
$load=sys_getloadavg(); | |
$results=array( | |
'memory' => round(exec("printf \$(free -m| grep Mem | awk '{ print \$3/\$2*100 }')"),2), | |
'disc' => (100-round(disk_free_space(getcwd())/disk_total_space (getcwd()) * 100,2)), | |
'cpu' => round(exec("grep 'cpu ' /proc/stat | awk '{cpu_usage=($2+$4)*100/($2+$4+$5)} END {print cpu_usage}'"),2), | |
'load' => $load[0] | |
); | |
die(json_encode($results)); |
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 | |
class SimpleStats { | |
private $url = 'http://localhost/'; | |
private $lock = '.stats.lock'; | |
private $network = 'lo'; | |
private $response = '/Unable to locate domain/'; | |
private $procs = array( | |
'/usr/sbin/mysqld', | |
'/usr/sbin/lighttpd', |
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
#include <curl/curl.h> | |
using namespace std; | |
string contents=""; | |
string check_url(string url){ | |
string results=""; | |
curl_global_init(CURL_GLOBAL_SSL ); | |
CURL* curl = curl_easy_init(); | |
if(curl) { | |
curl_easy_setopt (curl,CURLOPT_SSL_VERIFYHOST, 0L); |
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
<link rel="stylesheet" property="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css"> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script> | |
<script> | |
$("#category").select2({ | |
tags: true, placeholder :'Categories', width: '100%' | |
}); | |
$("#tags").select2({ | |
tags: true, placeholder :'Tags', width: '100%' | |
}); | |
$('.layout-picker').on('click', function(){ |
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 App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Response; | |
class Minify | |
{ | |
public function handle($request, Closure $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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /var/www/html/public; | |
index index.php index.html index.htm; | |
server_name localhost; | |
charset utf-8; |
OlderNewer