Skip to content

Instantly share code, notes, and snippets.

View vladfil's full-sized avatar

Vlad Filonenko vladfil

View GitHub Profile
@vladfil
vladfil / test.php
Last active September 13, 2018 08:41
function create_new_user_posts($user_id){
if (!$user_id>0)
return;
//here we know the user has been created so to create
//3 posts we call wp_insert_post 3 times.
// Create post object
$travel = array(
'post_title' => 'Travel',
'post_status' => 'buddydrive_private',
'post_author' => $user_id,
@vladfil
vladfil / cli.go
Last active January 5, 2018 08:58
CLI for copy files and folders to current directory
package main
import (
"fmt"
"io"
"os"
"path/filepath"
"strings"
)
if ($.browser.mobile) {
var scrollPos = 0;
$('#contactModal')
.on('show.bs.modal', function () {
scrollPos = pageYOffset || (document.documentElement.clientHeight ? document.documentElement.scrollTop : document.body.scrollTop);
$('body').css({
overflow: 'hidden',
width: '100%',
position: 'fixed',
@vladfil
vladfil / menu.php
Last active October 18, 2017 21:26
class Description_Walker extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
$classes = empty($item->classes) ? array () : (array) $item->classes;
$class_names = join(' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
!empty ( $class_names ) and $class_names = ' class="'. esc_attr( $class_names ) . ' nav-link w-nav-link"';
$output .= "";
$attributes = '';
!empty( $item->attr_title ) and $attributes .= ' title="' . esc_attr( $item->attr_title ) .'"';
!empty( $item->target ) and $attributes .= ' target="' . esc_attr( $item->target ) .'"';
package main
import(
"os"
"math"
"strconv"
)
const (
&::-webkit-contacts-auto-fill-button{
position: absolute;
right: 0;
top: 50%;
}
.logo{
width: 185px;
height: 65px;
img{
width: 100%;
}
}
// Create post
$('#send-post').click( function() {
var title = $('.add-posts input[name="title"]').val();
var post = $('.add-posts textarea[name="post"]').val();
console.log(screenReaderText.nonce);
$.ajax({
type: 'POST',
url: 'http://wordpress.localhost.dev/wp-json/wp/v2/posts',
/*
.parent{
display: flex;
flex-wrap:
flex-direction:
justify-content:
align-items:
align-content:
}
*/
@vladfil
vladfil / Gulpfile.js
Created July 24, 2017 19:08
Gulp for develop WordPress themes
var themename = 'NAME';
var gulp = require('gulp'),
// Prepare and optimize code etc
autoprefixer = require('autoprefixer'),
browserSync = require('browser-sync').create(),
image = require('gulp-image'),
jshint = require('gulp-jshint'),
postcss = require('gulp-postcss'),
sass = require('gulp-sass'),