Skip to content

Instantly share code, notes, and snippets.

View YaroslavB's full-sized avatar
🏠
Working from home

YaroslavB YaroslavB

🏠
Working from home
  • Kiev/Ukraine
View GitHub Profile
@YaroslavB
YaroslavB / A-Pen-by-YaroslavB.markdown
Created August 26, 2013 22:03
A Pen by YaroslavB.
<?php
/**
* The letter l (lowercase L) and the number 1
* have been removed, as they can be mistaken
* for each other.
* Tito code :eyeswideshut25@hotmail.com
*/
function createRandomPassword() {
<?php
$callback = $_GET['CKEditorFuncNum'];
$root = "uploads/ck";
if (!is_dir($root)) {
mkdir($root);
chmod($root, 0777);
}
@YaroslavB
YaroslavB / 1_phpunit-api.md
Last active November 14, 2015 07:34 — forked from loonies/1_phpunit-api.md
PHP Unit

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
<meta charset="utf-8">
<title>JS Bin</title>
<link href="https://fonts.googleapis.com/css?family=Catamaran" rel="stylesheet">
<style id="jsbin-css">
*, *:after, *:before {
box-sizing: border-box;
@YaroslavB
YaroslavB / gist:d90739f32c9c226b48dbe9d5e559d4a5
Created March 12, 2018 14:14 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@YaroslavB
YaroslavB / nginx.conf
Created March 12, 2018 15:01 — forked from biqqthiqq/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@YaroslavB
YaroslavB / 0. nginx_setup.sh
Created May 2, 2018 14:45 — forked from mikhailov/0. nginx_setup.sh
Nginx + secure pseudo-streaming
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software.
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module
# This module "secure-link" helps you to protect links from stealing away.
#
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg
cd /usr/src
wget http://nginx.org/download/nginx-1.5.13.tar.gz
tar xzvf ./nginx-1.5.13.tar.gz && rm -f ./nginx-1.5.13.tar.gz
@YaroslavB
YaroslavB / npm-commands.md
Last active December 19, 2018 10:31 — forked from ankurk91/npm-commands.md
Useful npm commands and tricks

npm v3.10 - ◾

⚠️ This gist is outdated, but most of the commands are still relevant.

Update npm itself

npm install -g npm
# Downgrade to a specific version
npm install -g npm@2

Этот урок переехал по адресу https://github.com/codedokode/pasta/blob/master/db/databases.md . Копия ниже устарела и не будет больше обновляться.


Что такое базы данных

База данных - это хранилище, в которое можно сохранять данные, а позже делать по ним поиск и загружать их. Ну например, на форуме в базе данных может храниться информация о пользователях сайта и написанных ими сообщениях. При просмотре страницы скрипт на сервере ищет в БД сообщения на определенную тему и выводит их на странице. Почти любой интерактивный сайт использует БД.

Конечно, можно попробовать сделать свое хранилище (к примеру, на файлах), но вряд ли оно будет работать так же быстро и надежно, как профессиональная база данных. Хорошая база данных гарантирует отсутствие потерь сохраненных данных, даже если неожиданно отключится питание, отсутствие проблем при одновременной работе нескольких пользователей, позволяет искать информацию по произвольным критериям.