Skip to content

Instantly share code, notes, and snippets.

View akopcz2's full-sized avatar
👾
workin

akopcz2

👾
workin
View GitHub Profile
<!-- UNIFY CUSTOM -->
<div class="uni-addon-products">
<h4>Receive Your Treats Every:</h4>
<select class="weekSelect">
<option deselected>Select Frequency</option>
<option value="2">One Time Purchase</option>
<option value="3" selected>Every 1 Week</option>
<option value="4">Every 2 Weeks</option>
@akopcz2
akopcz2 / gist:e0d2bbef98e63137ab6752e8c76b8fb4
Last active September 12, 2020 21:22
DOMStore FB Interview Question
We need to use a WeakMap because if we store the actual dom node as on Object or Map we would run into this issue [object Object]
class DOMStore {
constructor(){
this.store = new WeakMap();
}
set(key,val){
this.store.set(key,val);
}
get(key){
echo "
server {
listen 80;
server_name $1;
location / {
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header Host \$host;
proxy_pass http://127.0.0.1:$2;
@akopcz2
akopcz2 / loopingtables.js
Last active October 16, 2019 21:02
looping tables
<Fragment>
{data.tables.map((table, i) => {
return <section key={i} className="ourTable">
<table>
<caption>{table.title}</caption>
<tbody>
{table.rows.map((row, i) => {
return <tr className={`col-${i + 1}`} key={i}>
{row.cols.map((col, i) => {
return <td className={`col-${i + 1}`} key={i}>{col.value}</td>
@akopcz2
akopcz2 / table.json
Created October 16, 2019 20:55
Table rows and columns
{
"table":[{
"title":"Table Title",
"rows":[{
"cols":[
{
}
]
}]
@akopcz2
akopcz2 / gist:7af5726b37d71a491a2a0582ffd2e226
Created October 16, 2019 20:46
generic Table structure
<table>
<tr>
<th></th>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
switch (a) {
case a:
return <Component1 />
case b:
return <Component2 />
case …z
return <Components 3–26 /> etc…
default;
}
import {
Hero,
Footer
} from '../../components';
const components = {
hero: Hero,
footer: Footer
};
function DisplayThisStuff() {
/* Ajax call to API to get data 
window.addEventListener('resize', function(){
let desktopThumbnailWrapper = document.querySelector('.thumbnails-wrapper');
let desktopThumbnailParent = desktopThumbnailWrapper.parentNode;
let shopifyProductReviews = document.querySelector('#shopify-product-reviews');
let shopifyReviewsProductParent = shopifyProductReviews.parentNode;
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "{{ product.title | strip_html | escape }}",
"url": "{{ shop.url }}{{ product.url }}",
{% if current_variant.sku != blank %}
"sku": "{{ current_variant.sku }}",
{% endif %}