Skip to content

Instantly share code, notes, and snippets.

View rveitch's full-sized avatar

Ryan Veitch rveitch

View GitHub Profile
@rveitch
rveitch / sass-7-1-pattern.scss
Last active April 23, 2024 08:10
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
@rveitch
rveitch / index.js
Created November 28, 2018 15:52
fb-instagram-webhooks-node-example
// heroku callback url = https://fb-instagram-webhooks.herokuapp.com/facebook
// local callback url = http://rveitch.local.coschedule.ngrok.io/facebook
const dotenv = require('dotenv').load();
const bodyParser = require('body-parser');
const express = require('express');
const app = express();
const xhub = require('express-x-hub');
const _ = require('lodash');
const fbUtilities = require('./utilities/fb-utilities');
@rveitch
rveitch / next_prev_post.php
Last active December 5, 2023 20:04
Get next and prev posts in Wordpress by alphabetical order.
<?PHP
/*
* Sort Next/Previous Post Link Buttons Alphabetically
*/
function filter_next_post_sort($sort) {
if (get_post_type($post) == 'portfolio_page') {
$sort = "ORDER BY p.post_title ASC LIMIT 1";
}
else{
$sort = "ORDER BY p.post_date ASC LIMIT 1";
@rveitch
rveitch / google_ads_node_keywords_example.js
Created July 1, 2021 14:59
Google Ads Node Generate Keyword Ideas Exampke
const {
GoogleAdsClient,
GenerateKeywordIdeasRequest,
KeywordSeed,
} = require('google-ads-node'); // v2.0.4
const { StringValue } = require('google-protobuf/google/protobuf/wrappers_pb'); // v3.14.0
(async () => {
// Client
const oGoogleAdsClient = new GoogleAdsClient({
@rveitch
rveitch / nvm-auto-run.md
Created April 6, 2023 19:01 — forked from tcrammond/nvm-auto-run.md
Automatically nvm use when entering directory

Calling nvm use automatically in a directory with a .nvmrc file

Put this into your $HOME/.zshrc to call nvm use automatically whenever you enter a directory that contains an .nvmrc file with a string telling nvm which node to use:

place this after nvm initialization!

@rveitch
rveitch / sync_acf_post_title.php
Last active December 7, 2022 21:40
Update WordPress post title from an ACF field value on save. (Advanced Custom Fields)
<?php
/**
* Update Post Title from an ACF field value on post save.
*
* Triggers on save, edit or update of published posts.
* Works in "Quick Edit", but not bulk edit.
*/
function sync_acf_post_title($post_id, $post, $update) {
$acf_title = get_field('my_acf_field_name', $post_id); // NOTE: enter the name of the ACF field here
@rveitch
rveitch / mermaidtest.md
Created October 19, 2022 18:48
Mermaid Test

UML diagrams

You can render UML diagrams using Mermaid. For example, this will produce a sequence diagram:

sequenceDiagram
Alice ->> Bob: Hello Bob, how are you?
Bob-->>John: How about you John?
Bob--x Alice: I am good thanks!
Bob-x John: I am good thanks!
@rveitch
rveitch / eeprom-array.ino
Last active August 28, 2022 17:17
EEPROM Array
/*
FROM: http://forum.arduino.cc/index.php?topic=258193.0
I suppose that the data in EEPROM could also have been defined as:
uint16_t EEMEM eeArray[rows][cols];
or even as a single block,
uint8_t EEMEM eeArray[rows * cols * 2];
*/
#include <avr/eeprom.h>
@rveitch
rveitch / auto-set-featured-image.php
Created June 10, 2016 23:07
Automatically Set the Featured Image in WordPress from the first image in the post
const clusterUrls = ['http://127.0.0.1:9000', 'https://badserver.fail'];
(async () => {
const healthCheckPromises = clusterUrls.map((clusterUrl) => checkServerHealth(clusterUrl));
const results = await Promise.allSettled(healthCheckPromises);
return results;
})();
/**