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 / 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 / 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>
@nikola-wd
nikola-wd / _scrim-gradient.scss
Created August 5, 2019 00:08
[Scrim Gradient Mixin] - Smooth fading box-shadow #scrim #box-shadow #scss #sass
// background: linear-gradient(
// hsl(359, 100%, 100%) 0%,
// hsla(359, 100%, 100%, 0.738) 19%,
// hsla(359, 100%, 100%, 0.541) 34%,
// hsla(359, 100%, 100%, 0.382) 47%,
// hsla(359, 100%, 100%, 0.278) 56.5%,
// hsla(359, 100%, 100%, 0.194) 65%,
// hsla(359, 100%, 100%, 0.126) 73%,
// hsla(359, 100%, 100%, 0.075) 80.2%,
// hsla(359, 100%, 100%, 0.042) 86.1%,
@nikola-wd
nikola-wd / _header.js
Created August 5, 2019 00:11
[Fixed Header onScroll] - Header get's class when scrolled #ui #sass #scss #code_bundles #header
const _headerFN = () => {
const $header = document.querySelector('.header');
const scrollTop = window.scrollY,
offsetTop = 60;
if (scrollTop >= offsetTop && window.innerWidth > 767) {
$header.classList.add('jsOnScroll');
document.body.classList.add('jsOnScroll-header');
} else {