Skip to content

Instantly share code, notes, and snippets.

View sebastianrothbucher's full-sized avatar

Sebastian Rothbucher sebastianrothbucher

View GitHub Profile
@sebastianrothbucher
sebastianrothbucher / shoppable_src.txt
Created November 4, 2018 17:54
Shoppable content WP - Magento
<!-- wp:paragraph -->
Now this is going to be cool: you can shop for hoodies right here:
<span id="testspan"></span>
<script language="JavaScript">
window.addEventListener('load', function() { // (need magrest defined as proxy); could easily use React et al to create sth and a one-line statement loading it
fetch('/magrest/V1/products-render-info?storeId=1&currencyCode=EUR&searchCriteria[filter_groups][0][filters][0][field]=entity_id&searchCriteria[filter_groups][0][filters][0][value]=2&searchCriteria[filter_groups][0][filters][0][condition_type]=eq').then(res => res.json()).then(res => {
var a_ = document.createElement('a');
a_.target='_blank';
@sebastianrothbucher
sebastianrothbucher / README.md
Last active October 31, 2018 19:07
Using db-migrate with Magento 2

Using db-migrate with Magento 2

Usage:

  1. Put all these files in magento/app/db (htaccess is in place then), go in that dir and npm install
  2. Create a new migration with a command à la export export DATABASE_URL=$(php dburl.php); node_modules/.bin/db-migrate create <<nameofmigration>> --sql-file
  3. Run main migration with npm run dbup or export DATABASE_URL="$(php dburl.php)?multipleStatements=true"; node_modules/.bin/db-migrate up
@sebastianrothbucher
sebastianrothbucher / index.html
Last active October 22, 2018 20:25
style HTML5 inputs
<div>
<label class="date">Date <input type="date" id="dateInput" /></label> <span class="supportHint" id="dateSupported"></span>
</div>
<div>
<datalist id="sugg"><option>one</option><option>two</option><option>three</option></datalist>
<label class="suggestions">Suggestions <input type="text" list="sugg"
onFocus="this.placeholder=(this.value||'');this.value=''"
onChange="this.placeholder=this.value"
onBlur="this.value=(this.placeholder||'')"
<div class="cls1 inner">cls1</div>
<div class="cls2 inner">cls2</div>
@sebastianrothbucher
sebastianrothbucher / index.html
Last active September 21, 2018 16:13
scaling SVG
<svg id="scalesvg" viewBox="0 0 100 100">
<path fill="turquoise" d="M 0 50 L 50 0 L 100 50 L 50 100 Z" />
<text x="50" y="54" style="font-size: 12px; text-anchor: middle; ">Whatever</text>
</svg>
@sebastianrothbucher
sebastianrothbucher / index.html
Last active July 8, 2018 12:19
sandstorm twistie
<div id="demosection" class="section closed" style="width: 600px; ">
<div class="section-title" onclick="toggle()"><div class="arrow fa fa-arrow-right"></div> Click to open!</div>
<div class="section-content"><canvas id="sandstorm"></canvas>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</div>