Skip to content

Instantly share code, notes, and snippets.

@OrlandoST
OrlandoST / query.json
Created April 15, 2020 19:22
graphQL query examlres
query{
reference {
list(type: "color"){
items{
name
type
sort
}
}
@OrlandoST
OrlandoST / mysql-docker.sh
Created September 13, 2019 10:46 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@OrlandoST
OrlandoST / upgrade.sh
Last active April 6, 2019 21:34
Cloud9 PHP7.2
#!/bin/bash
## Upgrade to php7.2 and install required dependencies
# execute this script using
# source <(curl RAW_GIST_URL)
read -p "You are about to upgrade to PHP 7.2 OK? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo 'y' | sudo add-apt-repository ppa:ondrej/php && \
sudo apt-get update && \
in .htaccess
<IfModule mod_headers.c>
Header set Content-Security-Policy "default-src 'self' *.televizor-x.ru data: 'unsafe-inline' https://www.youtube.com https://yandex.ru https://mc.yandex.ru https://yastatic.net 'unsafe-eval'"
</IfModule>
@OrlandoST
OrlandoST / get_web_page.php
Created October 12, 2017 18:35 — forked from Fedcomp/get_web_page.php
Example remote page download with php-curl.
<?php
function get_web_page( $url ){
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
@OrlandoST
OrlandoST / gist:c572c872f72993e36babab878be8fe28
Created September 26, 2017 07:28
Joomla breadcrumbs с микроразметкой schema.org
<?php
/**
* @package Joomla.Site
* @subpackage mod_breadcrumbs
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Insert many rows as one query
* @param array $data Insert array(array('field_name' => 'field_value'), array('field_name' => 'field_value_new'))
* @return bool
*/
public function multiInsert(array $data)
{
$sqlStringTemplate = 'INSERT INTO %s (%s) VALUES %s';
$adapter = $this->tableGateway->adapter; /* Get adapter from tableGateway */
$driver = $adapter->getDriver();
@OrlandoST
OrlandoST / ZF2_snippets.php
Last active April 4, 2018 17:20
ZF2_Snippets
<?php
/***************************************************
* View Helper
**************************************************/
$this->getRequest()->getPost('id', null);
$this->headScript()->appendFile('/static/js/parsley.js','text/javascript');
$this->headLink()->appendStylesheet('/static/css/themenuebersicht.css');
<?php
$fooTable = new Application_Model_Useroptions;
$options = $fooTable->getUserOptions();
$checkboxes = new Zend_Form_Element_MultiCheckbox('checkboxes');
$checkboxes->setLabel('Options');
$checkboxes->setRegisterInArrayValidator(false);
foreach ($options as $opt)
$checkboxes->addMultiOption($opt->id_option, $opt->title);
@OrlandoST
OrlandoST / repo-full-copy.sh
Created March 12, 2016 12:17 — forked from AgiosAndreas/repo-full-copy.sh
Полный перенос git репозитория на другой сервер
# Клонируем исходный репозиторий без рабочего каталога (--bare)
git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
# Делаем mirror-push(будут скопированы все ветки и тэги) в новый репозиторий
git push --mirror https://github.com/exampleuser/new-repository.git
cd ..
# Удаляем папку с репозиторием