Skip to content

Instantly share code, notes, and snippets.

View leobossmann's full-sized avatar

Leo Bossmann leobossmann

  • noni Mode GmbH
  • Cologne, Germany
View GitHub Profile
@leobossmann
leobossmann / raidboxes_redirects.md
Created July 8, 2024 12:17
Get all redirects from Raidboxes backend

Paste this into your console when you are on the redirects settings page in you Raiboxes admin. Adjust subdomain value if needed or just remove.

const redirects = JSON.stringify([...document.querySelectorAll('[id^=redirect_item_]')].map(el => {
    return {
        subdomain: 'www',
        source: el.querySelector('[name$=_source]').value,
        target: el.querySelector('[name$=_target]').value,
        type: el.querySelector('[name$=_type]').value,
 regex: el.querySelector('[name$=_regex]').value,
@leobossmann
leobossmann / ee_funnel.js
Last active September 3, 2020 05:25
Checkout Steps for Enhanced Ecommerce labelling, originally by Rob Edlin, https://ecommerce.shopify.com/c/shopify-discussion/t/checkout-labelling-417229
var step_number = 0;
switch (Shopify.Checkout.step) {
case "contact_information":
step_number = 1;
break;
case "shipping_method":
step_number = 2;
break;
@leobossmann
leobossmann / ee_funnel.js
Created January 23, 2018 15:15
//Start of Checkout Steps for ee labelling originally by Rob Edlin, https://ecommerce.shopify.com/c/shopify-discussion/t/checkout-labelling-417229
var step_number = 0;
switch (Shopify.Checkout.step) {
case "contact_information":
step_number = 1;
break;
case "shipping_method":
step_number = 2;
break;
@leobossmann
leobossmann / ee_funnel.js
Created January 23, 2018 15:15
//Start of Checkout Steps for ee labelling originally by Rob Edlin, https://ecommerce.shopify.com/c/shopify-discussion/t/checkout-labelling-417229
var step_number = 0;
switch (Shopify.Checkout.step) {
case "contact_information":
step_number = 1;
break;
case "shipping_method":
step_number = 2;
break;
### Keybase proof
I hereby claim:
* I am leobossmann on github.
* I am bossmann (https://keybase.io/bossmann) on keybase.
* I have a public key ASBdS9TQTULT78FPiGc5MJ8PLMW1ksKIdlX47bqNQQs1aQo
To claim this, I am signing this object:
@leobossmann
leobossmann / extract.js
Created December 6, 2016 15:54
Extract and rename images from Pixieset
var imgs = new Array;
// replace all images by the xxl version
$('li > img').each(function(i, item){
var new_src = $(item).prop('src').replace('large', 'xxlarge');
$(item).prop('src', new_src);
imgs.push($(item));
});
// kill everything on page
$('body').empty();
@leobossmann
leobossmann / restart_bluetooth.sh
Created June 1, 2016 09:57 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@leobossmann
leobossmann / strong_params.rake
Created September 15, 2015 12:28
Rake task to create strong parameters definition
namespace :whatever do
desc "Outputs strong parameters for all of a model's attributes, ready to be pasted. Use with caution, it permits *everything*"
task :strong_params,[:model] => :environment do |t, args|
puts "\nprivate\n\n"
puts "def #{args.model.underscore}_params"
attributes = " :" + args.model.constantize.new.attributes.except("id", "created_at", "updated_at").keys.join(",\n :")
puts " params.require(:#{args.model.underscore}).permit(\n#{attributes}\n)"
puts "end"
end
end
@leobossmann
leobossmann / gist:ceace7b8ac0e93d049da
Created October 1, 2014 08:12
Shell function for colored status report on last executed command
#!/bin/bash
function echo_red {
echo -e "\033[0;31m$1\033[0m"
}
function echo_green {
echo -e "\033[0;32m$1\033[0m"
}
function echo_status {
@leobossmann
leobossmann / gist:5a4c2ae2bb1556f5237f
Last active August 29, 2015 14:05
Regex for getting usable info out of typo3's crummy <link> tags
typo3's link tags are formatted like this:
<link url target css-class title-attribute>Linktext</link>
to get all vital info, use this regex:
<link\s(\S+)[^"]*(?:"([^"]+)")?>([^<>]+)<\/link>
PHP to convert this to markdown and replace the wonderfully helpful default title:
$bodytext = preg_replace('/<link\s(\S+)[^"]*(?:"([^"]+)")?>([^<>]+)<\/link>/', "[$3]($1 \"$2\")", $this->bodytext);
$bodytext = preg_replace('/\[([^\[\]]+)\]\((\S+)\s{1}\\"Opens external link in new window\\"\)/', "[$1]($2 \"$1\")", $bodytext);
$this->bodytext = trim(html_entity_decode(strip_tags($bodytext)));