Skip to content

Instantly share code, notes, and snippets.

View grahamharper's full-sized avatar

Graham Harper grahamharper

View GitHub Profile
// ==UserScript==
// @name SPM Custom CSS Properties
// @namespace http://tampermonkey.net/
// @version 0.35
// @description SPM UI theme creation using CSS properties
// @author https://github.com/daithimorton
// @match https://*/*
// @match http://*/*
// @grant none
// @downloadUrl https://gist.github.com/daithimorton/467336d64f1a130ef622499634dd098c/raw/spmcssvar.user.js
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active April 21, 2025 09:17
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@RadGH
RadGH / recalculate-acf-locations.php
Last active July 19, 2023 19:16
Get latitude and longitude for addresses saved in Advanced Custom Fields, using Google's GeoLocation API
<?php
global $acf_recalc_settings;
// IMPORTANT: Customize these settings for your website.
$acf_recalc_settings = array(
// How many updates to do each page load. As of November 2018, Google's GeoLocation API limit is 100 per second.
'posts_per_run' => 16,
@jarkkolaine
jarkkolaine / authenticate_with_email.php
Created September 18, 2015 11:58
A simple code snippet for authenticating a user using email address
public function authenticate_with_email( $user, $email, $password ) {
if ( is_wp_error( $user ) ) {
// Already failed
return $user;
}
if( empty( $email ) || empty ( $password ) ) {
$error = new WP_Error();
if ( empty( $email ) ) {
$error->add( 'empty_username', __( '<strong>ERROR</strong>: Email field is empty.' ) );
@rg-najera
rg-najera / deploy.rb
Last active July 11, 2022 00:32
Bedrock / Sage Capistrano Deploy
set :repo_url, '[email protected]:Design-Collective/some-repo.git'
set :application, 'the-app-name.com'
set :theme_name, 'sage'
# Branch options
# Prompts for the branch name (defaults to current branch)
#ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp }
# Hardcodes branch to always be master
# This could be overridden in a stage config file
@muratsu
muratsu / after_platform_add_add_plugins.js
Created November 14, 2014 19:05
Hook to install plugins when a platform is added to cordova
#!/usr/bin/env node
//this hook installs all your plugins
var pluginlist = [
"org.apache.cordova.device",
"org.apache.cordova.console"
];
var fs = require('fs');
@bastianallgeier
bastianallgeier / nginx
Last active November 30, 2023 10:14
nginx setup
# block content
location ~ ^/content/(.*).(txt|md|mdown)$ {
rewrite ^/content/(.*).(txt|md|mdown)$ /error redirect;
}
# block all files in the site folder from being accessed directly
location ~ ^/site/(.*)$ {
rewrite ^/site/(.*)$ /error redirect;
}
@nateroling
nateroling / deploy.addendum.rb
Last active July 15, 2016 07:11
Roots Bedrock: Copy production assets for Roots theme
# The Roots theme by default does not check production assets into Git, so
# they are not deployed by Capistrano when using the Bedrock stack. The
# following will compile and deploy those assets. Copy this to the bottom of
# your config/deploy.rb file.
# Based on information from this thread:
# http://discourse.roots.io/t/capistrano-run-grunt-locally-and-upload-files/2062/7
# and specifically this gist from christhesoul:
# https://gist.github.com/christhesoul/3c38053971a7b786eff2
@bastianallgeier
bastianallgeier / statify.php
Last active October 4, 2022 17:12
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
@maxrice
maxrice / wc-customer-order-csv-export-modify-export-format.php
Created February 2, 2014 04:11
WooCommerce Customer/Order CSV Export - Add additional data to exports
<?php
// add custom column headers
function wc_csv_export_modify_column_headers( $column_headers ) {
$new_headers = array(
'lll_group' => 'LLL Group',
'registrant_type' => 'Registrant Type',
'partner_spouse' => 'Partner/Spouse',
// add other column headers here in the format column_key => Column Name