Skip to content

Instantly share code, notes, and snippets.

View PabloWestphalen's full-sized avatar
🏠
Working from home

Pablo Westphalen PabloWestphalen

🏠
Working from home
View GitHub Profile
#!/usr/bin/env bash
# WP-CLI Back up Script to Amazon S3
# Source: https://www.jonathan.vc
# Author: Jonathan Dingman
# Adapted from Mike at WP Bullet
#define local path for backups
BACKUPPATH=/tmp/backups
#path to WordPress installations
@ajayghaghretiya
ajayghaghretiya / functions.php
Created December 28, 2017 12:57
Do Payment via WooCommerce REST API for Stripe
add_action( 'rest_api_init', 'custom_api_endpoints' );
function custom_api_endpoints() {
/**
* Handle Payment Method request.
*/
register_rest_route( 'wc/v2', 'payment', array(
'methods' => 'POST',
'callback' => 'custom_payment_endpoint_handler',
@firatkucuk
firatkucuk / delete-slack-messages.js
Last active April 14, 2024 13:22
Deletes slack public/private channel messages, private chat messages and channel thread replies.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN';
// Legacy tokens are no more supported.
// Please create an app or use an existing Slack App
@Rich-Harris
Rich-Harris / service-workers.md
Last active April 21, 2024 16:24
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@tony-gutierrez
tony-gutierrez / AWS_Single_LetsEncrypt.yaml
Last active March 7, 2024 11:29
AWS Elastic Beanstalk .ebextensions config for single instance free SSL using letsencrypt certbot and nginx. http://bluefletch.com/blog/domain-agnostic-letsencrypt-ssl-config-for-elastic-beanstalk-single-instances/
# Dont forget to set the env variable "certdomain", and either fill in your email below or use an env variable for that too.
# Also note that this config is using the LetsEncrypt staging server, remove the flag when ready!
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory