Skip to content

Instantly share code, notes, and snippets.

View Stiropor's full-sized avatar
💭
Turning coffee into code

Marko Stiropor

💭
Turning coffee into code
View GitHub Profile
@maddisondesigns
maddisondesigns / functions.php
Last active February 7, 2024 13:42
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
@benmccallum
benmccallum / _Instructions.md
Last active July 25, 2021 03:35
nuxtjs, bootstrap-vue with custom bootstrap build

Important! This guide is out of date (circa 2017) and should no longer be used. For the latest advice, please refer to the BootstrapVue docs and their Nuxt.js module. https://bootstrap-vue.org/docs#nuxt-js

General setup:

  1. Install bootstrap as a dev dependency, and its dependencies (node-sass and sass-loader) npm install --save-dev bootstrap@4.0.0-beta.2 node-sass sass-loader
@YagoLopez
YagoLopez / deep-search-javascript-object.js
Last active January 8, 2023 10:02
Deep search javascript object
/* Attribution: http://techslides.com/how-to-parse-and-search-json-in-javascript */
//return an array of objects according to key, value, or key and value matching
function getObjects(obj, key, val) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getObjects(obj[i], key, val));
} else
@javilobo8
javilobo8 / download-file.js
Last active July 1, 2024 23:21
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@stursby
stursby / README.md
Last active May 13, 2022 07:41
Vue + Firebase + Auth Demo

Vue + Firebase + Auth Demo

A simple App using Vue.js & Firebase with Auth.

See the DEMO.

@Kovah
Kovah / mysql-levenshtein.sql
Created February 22, 2017 21:29
Levenshtein function for MySQL
-- Levenshtein function
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255;
-- thus the maximum string length this implementation can handle is also limited to 255 characters.
DELIMITER $$
DROP FUNCTION IF EXISTS LEVENSHTEIN $$
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8)
@CodeMyUI
CodeMyUI / full-page-parallax-scroll-effect.markdown
Created November 8, 2016 23:15
Full Page Parallax Scroll Effect
@hartliddell
hartliddell / InfiniteScroll-ES6.js
Created May 7, 2016 20:52 — forked from ChrisLTD/InfiniteScroll-ES6.js
Infinite "Scroll" javascript module for ES6
'use strict';
// Infinite scrolling loader, fires off a button click
//
// Sample HTML:
// <div id="infinite-scroll" class="js-infinite-scroll">
// POSTS HERE
// <a href="/url-to-more-content" class="js-infinite-scroll-next-button">Load More</a>
// </div>
// <div class="js-infinite-scroll-loading">...</div>
@sounisi5011
sounisi5011 / matches-closest.polyfill.js
Last active February 12, 2018 16:02 — forked from jonathantneal/matchesSelector.polyfill.js
Element.matches & Element.closest Polyfill
/**
* @see https://dom.spec.whatwg.org/#interface-element
* @see https://developer.mozilla.org/docs/Web/API/Element/matches#Polyfill
* @see https://gist.github.com/jonathantneal/3062955
* @see https://github.com/jonathantneal/closest
*/
(function(global){
var Element;
var ElementPrototype;
@ccurtin
ccurtin / Detect-if-IE.js
Created November 23, 2015 06:41
Detect if IE and add class to html/body..
/**
* detect IE
* returns version of IE or false, if browser is not Internet Explorer
*/
(function detectIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
if (msie > 0) {