Skip to content

Instantly share code, notes, and snippets.

@herbdool
herbdool / convert-d7media2backdrop.php
Last active November 18, 2023 02:26
Convert D7 Media to Backdrop Media
<?php
/**
* Convert d7 media to Backdrop media
*
* bee php-script convert-d7media2backdrop.php
*
* @todo add batching.
*/
@rockschtar
rockschtar / windows-wsl2-docker-lando-php-xdebug.md
Last active June 4, 2024 16:38
Windows 10/11 + WSL2 + Docker + Lando + PHP XDebug (PHPStorm, IntelliJ & Visual Studio Code (vscode))
  1. Install WSL
  2. Install your preferred WSL Linux Distro vom Microsoft Store. In my case I used Ubuntu 20.04.
  3. Install Docker for Windows
  4. Enable Docker WSL2 Integration image
  5. Install Lando inside WSL
wget https://github.com/lando/lando/releases/download/v3.6.0/lando-x64-v3.6.0.deb
dpkg -i --ignore-depends=docker-ce lando-x64-v3.6.0.deb
@klonos
klonos / bclone.sh
Created November 24, 2021 16:00
Clone a Backdrop project; optionally fetching one or more PRs locally.
#!/usr/bin/env bash
##
# Clone a Backdrop project; optionally fetching one or more PRs locally.
#
PROJECT=$1
PRS="${@:2}" # Get all arguments after the 1st one.
PROJECT_TYPES=("module" "theme" "layout" "profile")
PROJECT_TYPE=`wget --quiet --output-document=- https://raw.githubusercontent.com/backdrop-contrib/${PROJECT}/HEAD/${PROJECT}.info | awk '/type/ {print $3}'`
@klonos
klonos / startdrop.sh
Created November 24, 2021 15:43
Create a Backdrop instance using Lando.
ISSUE=$1
PR=$2
PHP=$3
INSTALL=$4
if [[ $(basename $PWD) = "docroot" ]]; then
echo "You are already in a docroot!!! Moving up one level..."
cd ..
fi
@TwoFistedJustice
TwoFistedJustice / bubbleUp.js
Last active June 22, 2024 19:23
This gist demonstrates how errors bubble up (or not) through the call stack depending on where you place your try-catch blocks.
/* This gist demonstrates how errors bubble up (or not) through the call stack
* depending on where you place your try-catch blocks
*
* You will get different results by reverse-commenting the two versions of the
* 'result' variable in topLevel()
* */
const topLevel = function(bool=false){
let name = topLevel.name;
try {
@veuncent
veuncent / youtube_analytics_oauth.md
Last active May 16, 2024 19:28
Authentication for Google / YouTube Analytics using a Brand Account

Google / YouTube Authentication using a Brand Account

Below describes the only way I was able to get (programmatic) access to the YouTube Analytics API on behalf of our Brand Account. Google documentation is convoluted, to say the least, so if you know a more straightforward way, please do share.

Getting a Client ID and Refresh Token

  1. Create a Project in the Developers Console - https://console.developers.google.com/
  2. Go to the Library tab and enable desired APIs (e.g. YouTube Analytics)
  3. Go to OAuth consent screen and make project external. Select Test mode
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active July 3, 2024 20:33
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@klonos
klonos / .lando.yml
Last active June 5, 2023 17:45
Backdrop Lando config
name: ???
# Use existing Backdrop recipe, then customize below.
recipe: backdrop
config:
# Where Backdrop resides, relative to this file.
webroot: docroot
database: mariadb
php: '?.?'
drush: '?.?.?'

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active June 29, 2024 01:12
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat