$query = "INSERT INTO table_name (" . implode(',', $columns) . ") VALUES "
. implode(
',',
array_map(function($data) {
return "(" . implode(",", array_fill(0, count($data) , '?')) . ")";
}, $datas)
)
. " ON DUPLICATE KEY UPDATE "
. implode(
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
$(document).ready(function(){ | |
$('a[href^="#"]').on('click',function (e) { | |
e.preventDefault(); | |
var target = this.hash; | |
var $target = $(target); | |
$('html, body').stop().animate({ | |
'scrollTop': $target.offset().top | |
}, 900, 'swing', 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
var os = require('os'); | |
function loadAvgCpus(){ | |
var cpus = os.cpus(); | |
var total=0; | |
var idle =0; | |
for (var i = 0; i<cpus.length ; i++) { |
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; | |
server_name example.com; | |
access_log /var/log/nginx/example.com.access.log; | |
error_log /var/log/nginx/example.com.error.log; | |
root /var/www/example.com; | |
index index.php; |
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
function flatten_multidimensional_array($array, $parentKey = NULL, $output = NULL ) | |
{ | |
$parentKey = isset($parentKey) ? $parentKey.'_' : ''; | |
$output = isset($output) ? $output : array(); | |
foreach ($array as $key => $value) | |
{ | |
switch (gettype($value)) | |
{ | |
case "string": |
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
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ | |
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [L,R=301] | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
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; | |
server_name example.com; | |
return 301 $scheme://www.example.com$request_uri; | |
} | |
server { | |
listen 80 default_server; | |
server_name *.example.com; | |
... |
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
docker update --restart=no |
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
Obtain a wildcard certificate using Let's Encrypt's new ACMEv2 server | |
certbot -d *.example.com --preferred-challenges=dns --manual certonly |
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
[ | |
{ | |
"name": "Worldwide", | |
"placeType": { | |
"code": 19, | |
"name": "Supername" | |
}, | |
"url": "http:\/\/where.yahooapis.com\/v1\/place\/1", | |
"parentid": 0, | |
"country": "", |
OlderNewer