Skip to content

Instantly share code, notes, and snippets.

View nikola-wd's full-sized avatar
💭
Available for full-time hire. React or Custom WordPress theme development.

Nikola Ivanov nikola-wd

💭
Available for full-time hire. React or Custom WordPress theme development.
View GitHub Profile
/* require */
var gulp = require('gulp'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
sass = require('gulp-ruby-sass'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
minifyCss = require('gulp-minify-css'),
imagemin = require('gulp-imagemin'),
@nikola-wd
nikola-wd / Visual Studio Code extensions
Last active July 20, 2021 20:05
Visual Studio Code extension list for configuration
abusaidm.html-snippets
akamud.vscode-theme-onedark
alefragnani.Bookmarks
alefragnani.project-manager
Angular.ng-template
anseki.vscode-color
anthonydiametrix.ACF-Snippet
burkeholland.simple-react-snippets
buzatto.ionic-basic-pack
christian-kohler.npm-intellisense
@nikola-wd
nikola-wd / mongoose-cheatsheet.md
Created February 23, 2018 09:57 — forked from subfuzion/mongoose-cheatsheet.md
mongoose cheatsheet

Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.

Install

$ npm install mongoose --save

Connect

const mongoose = require('mongoose');
@nikola-wd
nikola-wd / animatedScrollTo.js
Created December 5, 2018 00:54 — forked from joshbeckman/animatedScrollTo.js
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@nikola-wd
nikola-wd / ContactFormProcessing.php
Created December 17, 2018 02:05
Wordpress custom AJAX contact form (not working)
<?php
class ContactFormProcessing
{
protected $action = 'contact_form';
public function ajaxInit()
{
add_action("wp_ajax_{$this->action}", [$this, 'process']);
add_action("wp_ajax_nopriv_{$this->action}", [$this, 'process']);
}
/**
@nikola-wd
nikola-wd / linkedin_automate_follow.js
Created March 26, 2019 13:38
Linked automated follow script
let pageNumber = 2;
const MAX_PAGES_TO_GO_THROUGH = 10;
function scrollToBottom() {
window.scrollTo(0,document.body.scrollHeight);
}
function goToNextPage() {
document.querySelector('[aria-label="Page '+ pageNumber +'"]').click();
setTimeout(() => {
@nikola-wd
nikola-wd / mwehtaccessexample.yml
Created July 3, 2019 00:48
mwe .htaccess example
# ----------------------------------------------------------------------
# Rewrites / permalinks
# ----------------------------------------------------------------------
# ----------------------
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
@nikola-wd
nikola-wd / bitbucket-pipelines.yml
Created July 23, 2019 02:36 — forked from mcnamee/bitbucket-pipelines.yml
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add $FTP_USERNAME $FTP_PASSWORD and $FTP_HOST as environment variables.
# 2. Commit this file to your repo
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initial GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (from Bitbucket Cloud) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud) - if multiple deploys fail, you
@nikola-wd
nikola-wd / CommentFormProcessing.php
Last active March 12, 2023 20:11
Wordpress AJAX comment form in vanilla JS (es6) + axios (Comment submission without page refresh)
<?php
add_action( 'wp_ajax_ajaxcomments', 'ugwps_submit_ajax_comment' ); // wp_ajax_{action} for registered user
add_action( 'wp_ajax_nopriv_ajaxcomments', 'ugwps_submit_ajax_comment' ); // wp_ajax_nopriv_{action} for not registered users
function ugwps_submit_ajax_comment(){
$comment = wp_handle_comment_submission( wp_unslash( $_POST ) );
if ( is_wp_error( $comment ) ) {
$error_data = intval( $comment->get_error_data() );
if ( ! empty( $error_data ) ) {
wp_die( '<p>' . $comment->get_error_message() . '</p>', __( 'Comment Submission Failure' ), array( 'response' => $error_data, 'back_link' => true ) );
@nikola-wd
nikola-wd / google-map-api.html
Created August 3, 2019 17:37 — forked from bavington/google-map-api.html
Simple, custom Google Map (API 3.0)
<!doctype html>
<html>
<head>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false"></script>
<meta charset="UTF-8">
<title>Example Google Map</title>
</head>
<body>
<div id="map-canvas" style="height:400px; width:600px;"></div>
<script>