Skip to content

Instantly share code, notes, and snippets.

View jetfire21's full-sized avatar

Alexey S. jetfire21

View GitHub Profile
@jetfire21
jetfire21 / php_date_examples.php
Created May 11, 2017 09:43
PHP examples with dates
<?php
// Преобразует дату '28 Jan 2017' в '2017-01-28', a mysql работает с форматом 0000-00-00 00:00:00
echo date("Y-m-d",strtotime("28 Jan 2017"));
чтобы качественно отрисовать малеьнкую иконку,лучше это сделать в больше размере например 64х64
а уже затем после сведения всех слоев уменьшить до 16х16
@jetfire21
jetfire21 / lampp.txt
Created May 2, 2017 09:32
XAMPP/LAMPP configuration
=====================================================================
========= ошибка связанная с mysql: "Got error 'this version of PCRE is compiled without UTF support at offset 0' from regexp..." ===
xampp/lampp Решение:
download ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
enter the folder with extracted PCRE and run the following commands
# /home/jetfire/www/pcre-8.40/configure --prefix=/opt/lampp/lib/ --enable-utf8 --enable-unicode-properties make
@jetfire21
jetfire21 / git.txt
Created April 19, 2017 05:57
Git commands
========= делать push без ввода пароля и логина LINUX ================
ls -al ~/.ssh
ssh-keygen -t rsa -b 4096 -C "freerun-2012@yandex.ru"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
# check urls
git remote show origin
Push URL: https://github.com/jetfire21/bp-group-calendar.git
@jetfire21
jetfire21 / php_configuration.txt
Last active April 11, 2017 12:09
php configuration
directive = value
error_log = /opt/lampp/logs/php_error_log | /opt/lampp/logs/php_error_log
log_errors = On On
track_errors On On
================
запись php ошибок в указанный файл,в wordrpess надо сделать define('WP_DEBUG', false)
полезен когда на хостинг-сервере не созадется wp-content/debug.php
==============
@jetfire21
jetfire21 / wp_plugins_development.php
Last active April 4, 2017 21:21
functions used for development wp plugins
<?php
/*** проверка активирован ли плагин ******* */
/* Check if should include install file */
public function check_install() {
$current_version = get_option( 'wp_job_manager_field_editor_version' );
$plugin_activated = get_option( 'wp_job_manager_field_editor_activated' );
$force_install = isset( $_GET['jmfe_force_install'] ) ? TRUE : FALSE;
@jetfire21
jetfire21 / mapmarkerwordpress.php
Created March 30, 2017 19:15
A bit sloppy implimentation of Google Maps, MarkerClusters.js, and Wordpress location custom fields.
<?php
//Grabbing locations depending on the page
if ( is_page( 'facilities' ) ) {
$metaValue = 'facility';
} elseif ( is_page( 'dropoff' ) ) {
$metaValue = "dropoff";
} else {
$metaValue = "event";
}
@jetfire21
jetfire21 / google_map.html
Created March 30, 2017 19:07
markerclusterer in google map
<!-- Динамическая карта показывающая все точки(маркеры) с заданными координатами и группирующие кластеры,можно выводить
подсказки для марекров и кластеров -->
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="https://jobify-demos.astoundify.com/extended/xmlrpc.php" />
@jetfire21
jetfire21 / wp_plugin_and_setting_from_tyrqvir.txt
Created March 29, 2017 22:33
wp plugin and settings from third party Tyrqvir
---------------------------------------------------------- MUST BE -----------------------------------------------------------------
плагин для friendly url - Cyr to Lat enhanced
---------------------------------------------------------- SEO ---------------------------------------------------------------------
Плагин для SEO - Yoast SEO
---------------------------------------------------------- SECURITY ----------------------------------------------------------------
Плагины для защиты вордпресса бесплатные (связка) - Ithemes Secutiry и Wordfence Security
Плагин для аудита изменений на сайте WP Security Audit Log
@jetfire21
jetfire21 / wp_db_query.php
Last active May 11, 2017 09:45
queries to database on wp
<?php
/* ****** обновление сразу нескольких строк за 1 запрос *********** */
if( !empty($_POST['data']) ){
foreach ($_POST['data'] as $v) {
$post_title .= $wpdb->prepare("WHEN %d THEN %s ",(int)$v['timel_id'],sanitize_text_field($v['timel_title']));
$post_content .= $wpdb->prepare("WHEN %d THEN %s ",(int)$v['timel_id'],sanitize_text_field($v['timel_content']));
$post_date .= $wpdb->prepare("WHEN %d THEN %s ",(int)$v['timel_id'],sanitize_text_field($v['timel_date']));
$post_id .= (int)$v['timel_id'].",";
}
$post_id = substr($post_id, 0,-1);