Skip to content

Instantly share code, notes, and snippets.

@DmitriyRF
DmitriyRF / main.css
Created April 4, 2017 13:09
Border-^^^
content: "";
display: block;
position: absolute;
bottom: -9px;
left: 0;
width: 100%;
height: 9px;
background: -webkit-linear-gradient(transparent 0%, transparent 0%),
-webkit-linear-gradient(135deg, #f9f9f9 33.33%, transparent 33.33%) 0 0%,
transparent -webkit-linear-gradient(45deg, #f9f9f9 33.33%, transparent 33.33%) 0 0%;
@DmitriyRF
DmitriyRF / change.js
Last active July 22, 2024 18:24
Remove or don't redirect “thank you” page Mailchimp
/* To use this example:
1. Download this html file
2. Replace the form action url with your own from the MailChimp supplied embed code
3. Within the action url, replace "subscribe/post" with "subscribe/post-json"
4. Be sure the action url starts with http://. If it doesn't, the form will hang when testing the html as a local file in your browser.
5. Open this file in a browser on your local machine
*/
@DmitriyRF
DmitriyRF / compleate_version.php
Last active May 1, 2017 13:41
Wordpress admin list table php
<?php
/*
Plugin Name: Test List Table Example
*/
if( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
class My_Example_List_Table extends WP_List_Table {
var $example_data = array(
array( 'ID' => 1,'booktitle' => 'Quarter Share', 'author' => 'Nathan Lowell',
@DmitriyRF
DmitriyRF / replace.sql
Last active February 15, 2018 19:56
Поиск столюцов по БД
UPDATE [Таблица] SET [Поле]=REPLACE([Поле],'Строка_1','Строка_2');
//Or full changing
UPDATE `Darabase`.`wp_options` SET `option_value` = 'http://local.com' WHERE `wp_options`.`option_id` = 1;
UPDATE `DataBase`.`Table` SET `Table-column_1` = 'String_1' WHERE `Table`.`Table-column_2` = Value;
UPDATE wp_options
SET option_value = REPLACE(option_value, 'site.ca', 'local.site.ca')
@DmitriyRF
DmitriyRF / wp_posts
Last active December 26, 2017 14:07
SQL WordPress Database Menu
Information about currently select menu is located in wp_options table as serialized PHP array.
For example if we use TwentyEleven theme,
then we will have a record in wp_options table with option_name column equals to theme_mod_twentyeleven and
option_value column equals to ...;s:18:"nav_menu_locations";a:1:{s:7:"primary";i:103;}}.
Here you can see that menu with term_id equals to 103 is currently selected as "primary" menu.
The key principle here is that we always have separate options record for each WP theme.
Such options have the same name structure: theme_mods_{your-theme-name}.
Putting these lines into your powershell profile
(a file named profile.ps1 which sits in your Documents\WindowsPowerShell\ folder
(you may have to create that folder) will remove most of the unreadable colors:
Set-PSReadlineOption -TokenKind comment -ForegroundColor white
Set-PSReadlineOption -TokenKind none -ForegroundColor white
Set-PSReadlineOption -TokenKind command -ForegroundColor white
Set-PSReadlineOption -TokenKind parameter -ForegroundColor white
Set-PSReadlineOption -TokenKind variable -ForegroundColor white
Set-PSReadlineOption -TokenKind type -ForegroundColor white
var globalID;
function repeatOften() {
$("<div />").appendTo("body");
globalID = requestAnimationFrame(repeatOften);
}
$("#stop").on("click", function() {
cancelAnimationFrame(globalID);
});
@DmitriyRF
DmitriyRF / animation.js
Created March 23, 2018 11:06
JavaScript animation and timing functions
/************************************************************************************************************
_ _____ _ _ _ _ _
| | / ____| (_) | | (_) | | (_)
| | __ ___ ____ _| (___ ___ _ __ _ _ __ | |_ __ _ _ __ _ _ __ ___ __ _| |_ _ ___ _ __ ___
_ | |/ _` \ \ / / _` |\___ \ / __| '__| | '_ \| __| / _` | '_ \| | '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
| |__| | (_| |\ V / (_| |____) | (__| | | | |_) | |_ | (_| | | | | | | | | | | (_| | |_| | (_) | | | \__ \
\____/ \__,_| \_/ \__,_|_____/ \___|_| |_| .__/ \__| \__,_|_| |_|_|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
| |
|_|
**********************************
@DmitriyRF
DmitriyRF / functions.php
Created May 15, 2018 05:21
Adding separate page to WordPress
<?php
add_action( 'wp_enqueue_scripts', 'add_assets_to_enqueue', 20 );
function add_assets_to_enqueue() {
if ( is_page_template('page-tempalate_name.php') ) {
global $wp_scripts;
global $wp_styles;
@DmitriyRF
DmitriyRF / functions-reformate.php
Last active May 15, 2018 08:46
WordPress ajax request
<?php
//reformate file form
function reArrayFiles(&$file_post) {
$file_ary = array();
$file_count = count($file_post['name']);
$file_keys = array_keys($file_post);
for ($i=0; $i<$file_count; $i++) {
foreach ($file_keys as $key) {