Skip to content

Instantly share code, notes, and snippets.

@BaskSerg
BaskSerg / gist:508149490551b5e91ab820f505ab50f1
Created January 10, 2018 07:17 — forked from fzaninotto/gist:1308547
Inserting data to a database using Faker and PDO
<?php
$pdo = new PDO('mysql:host=hostname;dbname=defaultDbName', 'username', 'p@55w0rd');
$sql = 'INSERT INTO author (first_name, last_name, date_of_birth, email) VALUES (?, ?, ?, ?)';
$stmt = $pdo->prepare($sql);
$faker = \Faker\Factory::create();
$insertedPKs = array();
for ($i=0; $i < 100; $i++) {
$stmt->bindValue(1, $faker->firstName, PDO::PARAM_STR);
$stmt->bindValue(2, $faker->lastName, PDO::PARAM_STR);
$stmt->bindValue(1, $faker->date, PDO::PARAM_STR);
@BaskSerg
BaskSerg / add_recaptcha.php
Last active March 27, 2020 17:17
Add ReCaptcha to comments Wordpress
<?php
// Add to functions.php
add_action( 'wp_enqueue_scripts', 'add_recaptcha_js', 5, 1 );
function add_recaptcha_js() {
// Registration reCAPTHCA api.js, version - null, in footer - false
wp_register_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js?hl=en', array(), null, false );
// Include reCAPTHCA api.js
wp_enqueue_script( 'recaptcha' );
}
@BaskSerg
BaskSerg / send.php
Created December 14, 2017 06:41 — forked from webag/send.php
Добавление контакта и сделки в amocrm
<?
//amo
//ПРЕДОПРЕДЕЛЯЕМЫЕ ПЕРЕМЕННЫЕ
$responsible_user_id = 7292136; //id ответственного по сделке, контакту, компании
$lead_name = 'Заявка с сайта'; //Название добавляемой сделки
$lead_status_id = '11331793'; //id этапа продаж, куда помещать сделку
$contact_name = $cname; //Название добавляемого контакта
$contact_phone = $cphone; //Телефон контакта
@BaskSerg
BaskSerg / style.css
Created November 6, 2017 08:46
Table Responsive 1
/* CSS Mini Reset */
html, body, div, form, fieldset, legend, label
{
margin: 0;
padding: 0;
}
table
{
@BaskSerg
BaskSerg / remove-tinymce-editor-buttons.php
Created April 13, 2017 03:29
Remove buttons from the WordPress TinyMCE editor
<?php
/**
* Removes buttons from the first row of the tiny mce editor
*
*/
function remove_first_row_buttons($buttons) {
$remove = array(
'bold',
'italic',
'bullist',
@BaskSerg
BaskSerg / to-wp-config.php
Last active April 5, 2017 08:40
Запрещаем добавление новых тем, редактирование существующих тем, обновление тем, добавление новых плагинов, редактирование существующих плагинов, обновление плагинов, обновление версии движка WordPress; Добавляем эту строчку кода в файл wp-config.php:
<?php
define('DISALLOW_FILE_MODS', true);
@BaskSerg
BaskSerg / gist:4bb90b915cd4b0aa16ec0b4a5b51e04d
Last active April 14, 2017 04:28 — forked from zxcvbnm4709/gist:2656197
include jQuery in Chrome Console
var script = document.createElement("script");
script.setAttribute("src", "https://code.jquery.com/jquery-3.2.1.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
@BaskSerg
BaskSerg / .gitignore
Created October 25, 2016 03:18 — forked from salcode/.gitignore
WordPress .gitignore - this is my preferred gitignore file when working with WordPress. It ignores almost all files by default.
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20160309
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@BaskSerg
BaskSerg / wp-query-ref.php
Created May 19, 2016 07:31 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(