Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# Install Google's modified scrypt package for Firebase auth on macOS.
# https://github.com/firebase/scrypt
#
# Last tested on macOS Big Sur 11.3.1 (20E241)
#
brew install autoconf automake libtool

Turn WeMo smart plug on or off

curl -H 'Content-type:text/xml;  charset=utf-8' -H 'SOAPACTION:"urn:Belkin:service:basicevent:1#SetBinaryState"' -d '<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body><u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"> <BinaryState>1</BinaryState></u:SetBinaryState></s:Body></s:Envelope>' 'http://192.168.0.190:49153/upnp/control/basicevent1'
<?php
/**
* Template debug
*/
add_filter('template_include', function ($template) {
error_log('Template :: ' . $template);
return $template;
}, 99);
#!/bin/bash
# recursively walk directory and convert javascript files to typescript files
#
# .style.js -> .style.ts
# .js -> .tsx
#
# Usage `./convert-ts.sh src`
#
@jsakas
jsakas / acf-php-to-json.php
Created September 23, 2019 02:20 — forked from ollietreend/acf-php-to-json.php
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'

Wordpress: Custom page template with static home page

Wordpress ignores the selected page template for a page if you set it as a static home page, which is pretty frustrating in certain cases.

You can force it to use the custom page template by using this filter:

/**
 * Use selected page template for static home page
 */
@jsakas
jsakas / flywheel-local-xdebug-vscode.md
Created August 17, 2019 18:07 — forked from Niq1982/flywheel-local-xdebug-vscode.md
WordPress debugging with XDebug on Flywheel Local & VSCode

Flywheel Local configuration

Flywheel Local has XDebug installed by default if you choose “Custom” instead of “Preferred” when setting up a new local environment. If you don’t know which your current site is running, you can detect it by going to ”Site Setup” tab. If you can change the PHP version there, you have the “Custom” environment running. If not, just export your site, import it back and choose “Custom”.

Now that we have the right environment, remember what PHP version you are running, open the right PHP settings file (for example /Local Sites/my_site/conf/php/7.0.3/php.ini) and add these lines in the [Xdebug] section:

xdebug.remote_enable=1
xdebug.remote_autostart=1

Save the php.ini and restart your site container in Flywheel to apply new settings.

jest.mock('react-beautiful-dnd', () => ({
Droppable: ({ children }) => children({
draggableProps: {
style: {},
},
innerRef: jest.fn(),
}, {}),
Draggable: ({ children }) => children({
draggableProps: {
style: {},
#!/bin/bash
#
# Convert a directory of coffeescript test files to commonjs / jest
# and move them over to the src directory.
#
for coffee_file in $(find tests -name "*.coffee" -type f)
do
js_file=$coffee_file
js_file=$(echo "$js_file" | sed 's/Tests.coffee/.test.js/')
#!/bin/bash
# recursively walk directory
function traverse() {
for file in $(ls "$1")
do
#current=${1}{$file}
if [[ ! -d ${1}/${file} ]]; then
echo "${1}/${file}"