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 () { | |
let password = document.getElementById("password"); | |
let confirmPass = document.getElementById("confirm_password"); | |
let submit = document.getElementById("submit"); | |
function isPasswordStrong() { | |
const pattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})/g; | |
return pattern.test(password.value); | |
} |
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
#!/bin/sh | |
echo "Waiting for postgres..." | |
while ! nc -z database 5432; do | |
sleep 0.1 | |
done | |
echo "PostgreSQL started" |
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
# Necessary to prevent problems when using a controller named "index" and having a root index.php | |
# more here: http://httpd.apache.org/docs/2.2/content-negotiation.html | |
Options -MultiViews | |
# Activates URL rewriting (like myproject.com/controller/action/1/2/3) | |
RewriteEngine On | |
# Prevent people from looking directly into folders | |
Options -Indexes |
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 | |
try { | |
$pdo = new PDO( | |
'mysql:host=localhost;dbname=test_database', | |
'username', | |
'password', | |
array( | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, | |
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' |
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
// thin wrapper around local-storage to avoid | |
// errors if the browser does not support it. | |
var globalVar.localStorage = { | |
set: function(key, value) { | |
if (!swarm.localStorage.canStore()) { | |
return null; | |
} | |
return window.localStorage.setItem(key, value); | |
}, |
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
/* | |
<ul class='tabs'> | |
<li><a href='#tab1'>most viewed</a></li> | |
<li><a href='#tab2'>recent</a></li> | |
<li><a href='#tab3'>most commented</a></li> | |
</ul> | |
<div id='tab1'> | |
content 1111 | |
</div> | |
<div id='tab2'> |
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 | |
function array2json($arr) { | |
$parts = array(); | |
$is_list = false; | |
if (!is_array($arr)) return; | |
if (count($arr)<1) return '{}'; | |
//Find out if the given array is a numerical array | |
$keys = array_keys($arr); |
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 | |
if(isset($_GET['id']) && $_GET['id'] != ''){ | |
$usr_dir = "upload/".$_GET['id']."/"; | |
$error = ""; | |
//checking if zip module loaded | |
if(extension_loaded('zip')){ | |
$zip = new ZipArchive(); // подгружаем библиотеку zip | |
$zip_name = time().".zip"; // имя файла | |
if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE){ |
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
<script> | |
function unique(arr) { | |
var obj = {}; | |
for(var i=0; i<arr.length; i++) { | |
var str = arr[i]; | |
obj[str] = true; // запомнить строку в виде свойства объекта | |
} | |
return Object.keys(obj); // или собрать ключи перебором для IE<9 |
NewerOlder