Skip to content

Instantly share code, notes, and snippets.

View Ssssory's full-sized avatar

Ivan Ssssory

  • Voronej
View GitHub Profile
@Ssssory
Ssssory / download from url.py
Created March 29, 2022 13:40
download file from url
import requests
# const
DEFAULT_FILE_NAME = 'download.txt'
name = input('Enter filename. Default download.txt: ')
if not name:
name = DEFAULT_FILE_NAME
@Ssssory
Ssssory / twig.code-snippets
Created May 1, 2020 09:23
VScode snippets
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
@Ssssory
Ssssory / .env.travis
Created July 9, 2019 15:10 — forked from gilbitron/.env.travis
Laravel 5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
const ERROR_STATUS_400 = "400 Bad Request";
const ERROR_STATUS_401 = "401 Unauthorized";
const ERROR_STATUS_403 = "403 Forbidden";
const ERROR_STATUS_404 = "404 Not Found";
const ERROR_STATUS_405 = "405 Method Not Allowed";
const ERROR_STATUS_415 = "415 Unsupported Media Type";
const ERROR_STATUS_420 = "420 Enhance Your Calm";
const ERROR_STATUS_500 = "500 Internal Server Error";
const ERROR_STATUS_503 = "503 Service Unavailable";
<!-- попап заказать прайслист -->
<div class="fix_img_xls">
<div class="wrap_img_xls">
<img src="/xlsx.png" alt="получить прайс лист">
</div>
</div>
<div class="backiv"></div>
<div class="mailformiv">
<div class="wrapperiv">
<h3 style="text-align: center; margin-bottom: 30px;">Для получения прайслиста на почту, пожалуйста, заполните форму ниже:</h3>
@Ssssory
Ssssory / fork-example.php
Created June 4, 2018 07:23 — forked from nicksantamaria/fork-example.php
Example: Parallel processing in PHP using pcntl_fork()
<?php
/**
* @file
* Basic demonstration of how to do parallel threads in PHP.
*/
// This array of "tasks" could be anything. For demonstration purposes
// these are just strings, but they could be a callback, class or
// include file (hell, even code-as-a-string to pass to eval()).
<?php
class ReconnectingPDO
{
protected $dsn, $username, $password, $pdo, $driver_options;
public function __construct($dsn, $username = "", $password = "", $driver_options = array())
{
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
@Ssssory
Ssssory / cities.csv
Created January 17, 2018 03:27 — forked from nalgeon/cities.md
Города России с координатами
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 21 columns, instead of 18 in line 5.
Индекс,Тип региона,Регион,Тип района,Район,Тип города,Город,Тип н/п,Н/п,Код КЛАДР,Код ФИАС,Уровень по ФИАС,Признак центра района или региона,Код ОКАТО,Код ОКТМО,Код ИФНС,Часовой пояс,Широта,Долгота,Федеральный округ,Население
385200,Респ,Адыгея,,,г,Адыгейск,,,0100000200000,ccdfd496-8108-4655-aadd-bd228747306d,4: город,0,79403000000,79703000001,0107,UTC+3,44.8783715,39.190172,Южный,12689
385000,Респ,Адыгея,,,г,Майкоп,,,0100000100000,8cfbe842-e803-49ca-9347-1ef90481dd98,4: город,2,79401000000,79701000001,0105,UTC+3,44.6098268,40.1006527,Южный,144055
649000,Респ,Алтай,,,г,Горно-Алтайск,,,0400000100000,0839d751-b940-4d3d-afb6-5df03fdd7791,4: город,2,84401000000,84701000,0400,UTC+7,51.9582681,85.9602957,Сибирский,62861
658125,край,Алтайский,,,г,Алейск,,,2200000200000,ae716080-f27b-40b6-a555-cf8b518e849e,4: город,0,01403000000,01703000,2201,UTC+7,52.4920914,82.7794145,Сибирский,28528
656000,край,Алтайский,,,г,Барнаул,,,2200000100000,d13945a8-7017-46ab-b1e6-ede1e89317ad,4: город,2,01401000000,01701000,2200,UTC+7,53.
# Config and Htaccess Files
/upload/.htaccess
/upload/config.php
/upload/admin/config.php
# Image File
!/upload/image/no_image.jpg
# Image Cache Files
/upload/image/cache/*
$(document).ready(function() { // вся магия после загрузки страницы
$("#ajaxform").submit(function(){ // перехватываем все при событии отправки
var form = $(this); // запишем форму, чтобы потом не было проблем с this
var error = false; // предварительно ошибок нет
form.find('input, textarea').each( function(){ // пробежим по каждому полю в форме
if ($(this).val() == '') { // если находим пустое
alert('Заполните поле "'+$(this).attr('placeholder')+'"!'); // говорим заполняй!
error = true; // ошибка
}
});