Skip to content

Instantly share code, notes, and snippets.

Kaspars Dambis kasparsd

Block or report user

Report or block kasparsd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kasparsd
kasparsd / db-dump.sh
Last active Feb 15, 2019
Must-use plugin for WordPress plugin and theme demo sites
View db-dump.sh
#!/usr/bin/env bash
# Dump specific DB tables to a file.
mysqldump -u sqluser dbname wp_posts wp_postmeta > dump.sql
View wp-wishlist.md

My WordPress Development Wishlist

  • Standardize saving post meta attributes. The state of save_post is a mess. Is autosave, has nonce, has permissions, is cron, ir WP-API? See https://github.com/xwp/wp-safe-input

  • Introduce templating for building configuration screens in the admin. Probably as an abstraction over the Settings API that is actually friendlier and easier to use. Decouple data store from where and how the settings are presented to a user.

View icon-map.scss
$token-symbols: (
adx: '<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><circle cx="16" cy="16" r="16" fill="#1B75BC"/><path fill="#FFF" d="M11.587 8.602L16 13.208l4.305-4.606L23 11.36 18.604 16 23 20.603l-2.695 2.793L16 18.792l-4.413 4.604L9 20.68l4.36-4.706L9 11.36l2.587-2.757zm.355-.376L15.982 4l4.04 4.226-2.126 2.265-1.914-2.114-1.914 2.114-2.126-2.265zm0 15.548l2.126-2.265 1.914 2.114 1.914-2.114 2.126 2.265L15.982 28l-4.04-4.226z"/></g></svg>',
ae: '<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><circle cx="16" cy="16" r="16" fill="#DE3F6B"/><path fill="#FFF" fill-rule="nonzero" d="M9.752 11h.904c1.413.134 2.72.821 3.687 1.81 2.009 2.039 3.113 4.916 5.67 6.433 1.848 1.097 4.433.2 5.341-1.654.462-.008.927-.008 1.389-.006-.636 1.883-2.489 3.236-4.515 3.417h-.746c-1.247-.1-2.46-.564-3.403-1.366-1.37-1.123-2.25-2.664-3.315-4.036-.916-1.213-1.85-2.577-3.366-3.128-1.873-.679-4.16.383-4.843 2.187-.6 1.486-.112 3.328 1.23 4.28 1.006.752 2.407 1.033 3.615.
View radio-notes.md

RFM69_initialise

  • Set MY_RFM69_POWER_PIN mode to OUTPUT, if defined.

  • Power up the radio RFM69_powerUp().

  • Reset radio module, if MY_RFM69_RST_PIN is defined.

  • Configure radio:

@kasparsd
kasparsd / filter.php
Created Nov 25, 2018
Contact Form 7 Lead info with country support for Storage for Contact Form 7
View filter.php
<?php
add_filter( 'wpcf7_special_mail_tags', function( $output, $name ) {
if ( 'tracking-info' === $name && function_exists( 'wpshore_wpcf7_before_send_mail' ) ) {
$replaced = wpshore_wpcf7_before_send_mail( array( 'body' => '[tracking-info]' ), null, null );
return $replaced['body'];
}
return $output;
}, 10, 2 );
@kasparsd
kasparsd / mail-attachments-fix.md
Created Nov 15, 2018
Storage for Contact Form 7: Link to attachment URLs even when not sending the attachment
View mail-attachments-fix.md

Replace the wpcf7_mail_components() method in src/class-cf7-storage.php with the following:

function wpcf7_mail_components( $components, $form ) {
    $submission = WPCF7_Submission::get_instance();

    if ( ! empty( $components['body'] ) && $submission ) {
        $components['body'] = $this->mail_replace_file_urls( $components['body'], $submission->uploaded_files() );
    }
@kasparsd
kasparsd / boot.py
Last active Nov 10, 2018
Wemos ESP8266 Home Assistant Binary Sensor Example
View boot.py
import network
SSID = ''
PASSWORD = ''
def do_connect():
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to network...')
View eparaksts.md

WS-Federācijas protokola specifikāciju vai Shibbolech WebSSO profilu.

View alcatel-mw40v.md
$ sudo cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  5 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bbb ProdID=0195 Rev= 2.42
S:  Manufacturer=Alcatel
S:  Product=Mobilebroadband
S:  SerialNumber=1234567890ABCDE
C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=500mA
@kasparsd
kasparsd / vip-deploy.sh
Last active Aug 9, 2018
Deploy script for WordPress VIP
View vip-deploy.sh
#!/usr/bin/env bash
# Set this to -ex for verbose output.
set -e
# Set the working directory to the repository root.
cd "$(dirname "$0")/.."
DEPLOY_BRANCH="$2"
SVN_REPO="$1"
You can’t perform that action at this time.