Skip to content

Instantly share code, notes, and snippets.

View martincarlin87's full-sized avatar
💻

Martin Carlin martincarlin87

💻
View GitHub Profile
import React, { useState, useMemo } from "react"
import { calculateTotals } from "./utils"
export default function SelectTickets({
context: { workshopData, subscriberCode },
send
}) {
let initialTicketsToPurchase = useMemo(
() =>
workshopData.ticketTypes.reduce((ticketsToPurchase, type, index) => {
@JohnnyWalkerDigital
JohnnyWalkerDigital / laravel_email_reset_fix.md
Last active October 11, 2022 13:18
Laravel: Setting up password reset to work as expected

Here's how set your password reset experience so that the user doesn't have to enter their email address... without altering vendor/core - tested with Laravel 5.8 (should be fine with later versions, too):

1. Create own notification

Firstly create a new notification for your app:

php artisan make:notification ResetPassword

Then open the newly created file: app\Notifications\ResetPassword.php and make the following changes:

@alecthegeek
alecthegeek / show-volumes-from-docker-option.sh
Last active August 28, 2018 12:42
An example of using --volumes-from option in Docker
#!/usr/bin/env bash
docker container rm -f writer reader
docker volume rm testdata
docker container run --mount source=testdata,target=/tmp/data --name=writer -d alpine /bin/sh -c 'while echo $(( m += 1 )) >> /tmp/data/1 ; do sleep 5 ; done'
docker container inspect --format '{{.Mounts}'} writer
docker container run --volumes-from writer --name=reader -d alpine /bin/sh -c 'while true ; do sleep 600 ; done'
docker container inspect --format '{{.Mounts}'} reader
docker container exec -it reader tail -f /tmp/data/1
var viewer = new Cesium.Viewer('cesiumContainer');
var screenSpaceEventHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
var startPoint = new Cesium.Cartographic();
var endPoint = new Cesium.Cartographic();
// Event handler for left click
screenSpaceEventHandler.setInputAction(function(click) {
@dvlop
dvlop / gist:fca36213ad6237891609e1e038a3bbc1
Last active May 15, 2024 20:03 — forked from allthingsdem/gist:63b3223a7d14ac1f2457
My long list of bad bots to block in htaccess, ready to copy and paste!
# Start Bad Bot Prevention
<IfModule mod_setenvif.c>
# SetEnvIfNoCase User-Agent ^$ bad_bot
SetEnvIfNoCase User-Agent "^12soso.*" bad_bot
SetEnvIfNoCase User-Agent "^192.comAgent.*" bad_bot
SetEnvIfNoCase User-Agent "^1Noonbot.*" bad_bot
SetEnvIfNoCase User-Agent "^1on1searchBot.*" bad_bot
SetEnvIfNoCase User-Agent "^3D_SEARCH.*" bad_bot
SetEnvIfNoCase User-Agent "^3DE_SEARCH2.*" bad_bot
SetEnvIfNoCase User-Agent "^3GSE.*" bad_bot
@lukecav
lukecav / functions.php
Created October 20, 2017 15:50
Disable status dashboard widget in WooCommerce
function disable_woocommerce_status_remove_dashboard_widgets() {
remove_meta_box( 'woocommerce_dashboard_status', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'disable_woocommerce_status_remove_dashboard_widgets', 40);
@lukecav
lukecav / functions.php
Last active December 6, 2017 11:15
Disable reviews dashboard widget in WooCommerce
function disable_woocommerce_reviews_remove_dashboard_widgets() {
remove_meta_box( 'woocommerce_dashboard_recent_reviews', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'disable_woocommerce_reviews_remove_dashboard_widgets', 40);
@martinvirtel
martinvirtel / krpano-to-marzipano.config
Last active May 2, 2023 19:28
Generate tile files for marzipano.net panorama viewer with krpanotools from krpano.com
# Generate tile files that can be used with https://www.marzipano.net
# This is a config file for https://krpano.com/tools/kmakemultires/config/ -
flash=false
html=false
xml=false
panotype=autodetect
tilesize=512
@lukecav
lukecav / Query
Last active April 22, 2024 09:22
MySQL script to get all WooCommerce orders including metadata
select
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name,
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name,
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_1,
max( CASE WHEN pm.meta_key = '_billing_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_2,
max( CASE WHEN pm.meta_key = '_billing_city' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_city,
max( CASE WHEN pm.meta_key = '_billing_state' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_state,
@ShawnMcCool
ShawnMcCool / .zshrc
Last active July 19, 2017 13:58
Moves the most recently modified file from the source directory to the destination directory.
alias mvltr="~/scripts/mvltr.sh"
alias ltr="ls -ltr"