This file contains hidden or 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
<VirtualHost localhost:80> | |
ServerName test.dev | |
ServerAlias www.test.dev | |
DocumentRoot /home/yura/projects/test.dev | |
<directory /home/yura/projects/test.dev> | |
AllowOverride All | |
Require all granted | |
</directory> | |
ErrorLog /home/yura/projects/test.dev/logs/error.log | |
LogLevel warn |
This file contains hidden or 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 | |
$i = 1; | |
$path = 'files/'; // path to files | |
$separator = '-logo-'; // separator to divide the string and take the first part | |
$errors = []; | |
foreach (glob($path . '*.*') as $name) { | |
$filename = basename($name); | |
$arrayOfString = explode($separator, $filename); |
This file contains hidden or 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 getIp() | |
{ | |
//check ip from share internet | |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) { | |
return $_SERVER['HTTP_CLIENT_IP']; | |
} | |
//to check ip is pass from proxy | |
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { | |
return $_SERVER['HTTP_X_FORWARDED_FOR']; |
This file contains hidden or 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 loadDeferredStyles = function() { | |
var addStylesNode = document.getElementById("deferred-styles"); | |
var replacement = document.createElement("div"); | |
replacement.innerHTML = addStylesNode.textContent; | |
document.body.appendChild(replacement) | |
addStylesNode.parentElement.removeChild(addStylesNode); | |
}; | |
var raf = requestAnimationFrame || mozRequestAnimationFrame || | |
webkitRequestAnimationFrame || msRequestAnimationFrame; | |
if (raf) raf(function() { window.setTimeout(loadDeferredStyles, 0); }); |
This file contains hidden or 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
sudo npm cache clean -f | |
sudo npm install -g n | |
sudo n stable | |
# if not working | |
sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/nodejs |
This file contains hidden or 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
// for passwords add to ht.access | |
AuthType Basic | |
AuthName "Private zone. Only for administrator!" | |
AuthUserFile /home/path/to/site.dev/.htpasswd | |
require valid-user | |
// and run command | |
htpasswd -c /home/path/to/site.dev/.htpasswd admin |
This file contains hidden or 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
cd /etc/nginx/sites-available/ | |
sudo touch new.site.conf | |
sudo nano new.site.conf | |
cd ../sites-enabled | |
sudo ln -s ../sites-available/new.site.conf . | |
sudo mcedit /etc/hosts | |
sudo nginx -t |
This file contains hidden or 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
To export | |
If it's an entire DB, then: | |
$ mysqldump -u [uname] -p[pass] db_name > db_backup.sql | |
If it's all DBs, then: | |
$ mysqldump -u [uname] -p[pass] --all-databases > all_db_backup.sql | |
If it's specific tables within a DB, then: | |
$ mysqldump -u [uname] -p[pass] db_name table1 table2 > table_backup.sql |
This file contains hidden or 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 "DHT.h" | |
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
#define DHTPIN 4 | |
LiquidCrystal_I2C lcd(0x3F, 16, 2); | |
DHT dht(DHTPIN, DHT11); | |
void setup() { | |
Serial.begin(9600); |
This file contains hidden or 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
@if (isset($paginator) && $paginator->lastPage() > 1) | |
<ul class="pagination"> | |
<?php | |
$interval = isset($interval) ? abs(intval($interval)) : 3 ; | |
$from = $paginator->currentPage() - $interval; | |
if($from < 1){ | |
$from = 1; | |
} |
OlderNewer