Skip to content

Instantly share code, notes, and snippets.

View ThatGuySam's full-sized avatar
🍉
Discovering the wonders of JAMStack

Sam Carlton ThatGuySam

🍉
Discovering the wonders of JAMStack
View GitHub Profile
@rayfranco
rayfranco / README.md
Last active June 1, 2021 07:49
Inline SVG with Nuxt

Inline SVG with Nuxt

I was looking for a SSR and scoped styles ready solution to implement inline SVG with Nuxt

You need svg-inline-loader and xmldom to be installed.

@ChrisFlannagan
ChrisFlannagan / geodistance.php
Created October 13, 2017 16:52
Calculate distance between to coordinates of latitude and longitude using the WP REST API and return posts ordered by distance from user's coordinates
<?php
/**
* Heavily borrowed from: http://xplus3.net/2010/08/08/filtering-on-a-non-standard-database-field-with-wordpress/
**/
class CoordinatesTable extends DB {
protected $db_option = "coordinates_db";
@clemlatz
clemlatz / smooth-scroll.js
Created September 6, 2017 08:56
Simple smooth-scroll animation in pure/vanilla javascript
/**
* Smooth scroll animation
* @param {int} endX: destination x coordinate
* @param {int) endY: destination y coordinate
* @param {int} duration: animation duration in ms
*/
window.smoothScrollTo = function(endX, endY, duration) {
var startX = window.scrollX || window.pageXOffset,
startY = window.scrollY || window.pageYOffset,
distanceX = endX - startX,
@neilrackett
neilrackett / php-to-moment.js
Last active December 13, 2022 07:39
Convert PHP date string to Moment.js format
function phpToMoment(str) {
let replacements = {
'd' : 'DD',
'D' : 'ddd',
'j' : 'D',
'l' : 'dddd',
'N' : 'E',
'S' : 'o',
'w' : 'e',
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 24, 2024 14:17
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@evantahler
evantahler / buildSitemap.js
Last active December 17, 2020 16:35
35 lines to build a sitemap for next.js projects
#! /usr/bin/env node
// I am ./bin/buildSitemap.js
const path = require('path')
const glob = require('glob')
const fs = require('fs')
const SITE_ROOT = process.env.SITE_ROOT || 'https://www.actionherojs.com'
const SOURCE = process.env.SOURCE || path.join(__dirname, '..', 'pages', '/**/*.js')
const DESTINATION = process.env.DESTINATION || path.join(__dirname, '..', 'static', 'sitemap.xml')
@mitrakmt
mitrakmt / binarySearchTree.js
Created September 21, 2016 15:11
Implement a Binary Search Tree in JavaScript
// This Binary Search Tree is implemented using the prototypal pattern
var BinarySearchTree = function(value) {
var instance = Object.create(BinarySearchTree.prototype);
instance.value = value;
// a BST where all values are higher than than the current value.
instance.right = undefined;
// a binary search tree (BST) where all values are lower than than the current value.
instance.left = undefined;
@KazWolfe
KazWolfe / Pokemon GO Data Dump.txt
Last active February 28, 2022 04:27
A data dump of a lot of cool Pokemon GO facts
###########
# Pokemon GO Data Dump (in no order)
# By Kaz Wolfe (@KazWolfe on gaming.stackexhange.com)
# Dump version 3.3, pulled from 0.29.0
#
# Feel free to use this dump in anything, but please link back to it!
# This ensures that people can see and use the source of the data
# (which updates regularly), and find out new things.
#
# Thanks Anonymous for some data: https://gist.github.com/anonymous/077d6dea82d58b8febde54ae9729b1bf
@ddemuth
ddemuth / woocommerce-custom-email-recipient.php
Last active January 30, 2021 21:42
Customize the email recipient
//WooCommerce Email Customizations
add_filter( 'woocommerce_email_recipient_customer_note', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2);
add_filter( 'woocommerce_email_recipient_customer_completed_order', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2);
add_filter( 'woocommerce_email_recipient_customer_invoice', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2);
add_filter( 'woocommerce_email_recipient_customer_processing_order', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2);
/**
* $recipient could be comma separated to send to additional people
* EX. $recipient .= ', $additonal_recipient';
*/