Skip to content

Instantly share code, notes, and snippets.

View evanre's full-sized avatar
👨‍💻
Code is poetry.

Yevhen Zhuchenko evanre

👨‍💻
Code is poetry.
View GitHub Profile
@evanre
evanre / custom-setup.php
Last active October 24, 2022 18:44
Just another WordPress debug function
/**
* Simple debug trace to the end of the page
*
* @usage d( $data );
*/
if ( true === WP_DEBUG ) {
function d( $data ) {
@evanre
evanre / browser_specific.js
Created January 25, 2016 17:44
Browser and Device specific CSS styles with SASS
document.documentElement.setAttribute("data-browser", navigator.userAgent);
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@evanre
evanre / Flexbox Grid Sass.scss
Last active November 21, 2018 10:14
Generated by SassMeister.com.
/**
* Flex Grid
*/
//
// Usage
// =====
// Assuming default values:
// <div class="row">
// <div class="col-xs-6">
// A half-width column.
@evanre
evanre / contact-form-7-code-editor.php
Created October 23, 2018 21:44
Contact Form 7 Code Editor
<?php
/**
* Plugin Name: Contact Form 7 Code Editor
* Version: 1.0.0
* Plugin URI: https://latinandcode.com/
* Author: Eugene Zhuchenko
* Author URI: eugenezhuchenko.com
* Text Domain: elementor-latinandcode
* Domain Path: /languages/
* License: GPL v3
@evanre
evanre / map_value.php
Created August 30, 2018 15:35
Re-maps a number from one range to another
/**
* map_value()
*
* Re-maps a number from one range to another. That is, a value of fromLow would get mapped to toLow, a value of fromHigh to toHigh, values in-between to values in-between, etc.
* @url: https://www.arduino.cc/reference/en/language/functions/math/map/
*
* @param $val integer - the number to map
* @param $in_min integer - the lower bound of the value’s current range
* @param $in_max integer - the upper bound of the value’s current range
* @param $out_min integer - the lower bound of the value’s target range
@evanre
evanre / script.js
Created August 19, 2018 16:50
Search for nice and short domains script
/**
* Search for nice and short domains.
* Use for example a NameCheap
*/
// Flatten array. Ex.: ['aa', 'ab', ['ac', 'ad']] => ['aa', 'ab', 'ac', 'ad']
const flatten = arr => [].concat.apply([], arr);
// Remove non-unique items from given array
const uniq = a => [...new Set(a)];
@evanre
evanre / log.php
Last active July 26, 2018 19:03
Simple debug trace to wp-content/debug.log
/**
* Simple debug trace to wp-content/debug.log
*
* @usage _log( $var );
*/
if ( ! function_exists( '_log' ) ) {
function _log() {
$args = func_get_args();
@evanre
evanre / extend.scss
Created May 31, 2018 11:40
Sass add configuration objects to extend default params for mixins
// Configuration objects / Extend default mixin params with custom ones
// @src: https://hugogiraudel.com/2014/05/05/bringing-configuration-objects-to-sass/
// Default var for overriding
$params: () !default;
// @param {map} $obj - object with default params
// @param {map} $ext-obj - object params to extend the default
@function extend($obj, $ext-obj) {
@return map-merge($obj, $ext-obj);
}
@evanre
evanre / gulpfile.js
Created May 9, 2017 09:22
Wordpress gulpfile.js
var
// global
gulp = require('gulp'),
watch = require('gulp-watch'),
browserSync = require("browser-sync"),
reload = browserSync.reload,
sass = require('gulp-sass'),
prefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),