Skip to content

Instantly share code, notes, and snippets.

Michaël Gallego bakura10

Block or report user

Report or block bakura10

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.php
$variants = [];
foreach ($shopifyClient->getVariantsIterator(['fields' => 'id,inventory_quantity']) as $variant) {
$variants[$variant['id']] = $variant['inventory_quantity'];
}
foreach ($products as $index => $product) {
$delay = (int) ($index / 4);
if ($product['quantity'] === $variants[$product['id']] {
View test.php
foreach ($products as $index => $product) {
$this->messageQueue->push(new DelayedMessage('product.validate_stock', [
'product' => $product['id']
], $index);
}
$this->messageQueue->flush();
@bakura10
bakura10 / instagram-patch.liquid
Created Jan 12, 2018
Update to fix the Instagram Section for Focal—premium Shopify theme
View instagram-patch.liquid
<script>
window.addEventListener("DOMContentLoaded",function(){var a=function(a){var e=new Date(1e3*a.created_time),t=e.getMonth(),n=e.getDate(),i=e.getFullYear(),r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return a.created_time=r[t]+" "+n+", "+i,!0},e=function(e){var t={% raw %}'<div class="instagram-fix grid__cell 1/2 1/3--handheld-and-up 1/'+e.attr("data-images-per-row")+'--lap-and-up"><div class="instagram__image-wrapper" style="background-image: url({{image}})"><a href="{{link}}" target="_blank"><div class="instagram__overlay"><p class="instagram__caption">{{caption}}</p><time class="instagram__date">{{model.created_time}}</time></div></a></div></div>'{% endraw %};new Instafeed({get:"user",userId:"self",accessToken:e.attr("data-access-token"),sortBy:"most-recent",limit:e.attr("data-limit-images"),resolution:"standard_resolution",template:t,filter:$.proxy(a)}).run()};$(".index-module__instagram[data-access-token]").each(function(a,t){e($(t))})});
</script>
<style>
.ins
@bakura10
bakura10 / instagram-patch.liquid
Created Jan 12, 2018
Update to fix the Instagram Section for Kagami—premium Shopify theme
View instagram-patch.liquid
<script>
window.addEventListener("DOMContentLoaded",function(){var e=function(e,t){new Instafeed({get:"user",userId:"self",accessToken:e,sortBy:"most-recent",limit:t,resolution:"standard_resolution",template:{% raw %}'<div class="instagram__image-wrapper instagram-fix"><a href="{{link}}" style="background-image: url({{image}})" target="_blank"><div class="instagram__overlay"><p class="instagram__caption">{{caption}}</p><time class="instagram__date">{{model.created_time}}</time></div></a></div>'{% endraw %},after:function(){$("#instafeed-mobile").append($("#instafeed").html())},filter:$.proxy(function(e){var t=new Date(1e3*e.created_time);m=t.getMonth(),d=t.getDate(),y=t.getFullYear();var a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return e.created_time=a[m]+" "+d+", "+y,!0})}).run()};!function(t){var a=t.attr("data-instagram-access-token"),n=t.attr("data-twitter-username");a&&e(a,n?3:6)}($(".index-module__social"))});
</script>
<style>
.instagram__image-wrapper > a {
p
View gist:c43062615c175c5e79075a24d368c8e6

DISCLAIMER: this is not really only about slate, just rough ideas on what I'd like to see in Shopify and that could be achieved in JS.

Hi everyone,

I had a talk with @t-kelly a few days ago and I'd like to expand on an idea that should represent what Slate could be in the future or what are the main frustration points in developing Shopify Themes.

Origin

We're now trying to develop more and more complex themes, both for the theme stores and clients. We're always trying to push the boundaries of what is possible with Shopify.

View gist:afa21c88d05c25c36d67ffb85630b836
Pipeline events:
* add_product.pre
* add_product.post
Theme could add messages to the pipeline:
ShopifyApi.Pipeline.addProduct(1234, 1).then(function(pipelineStatus, cart) {
// do things
});
View command.php
<?php
class SendSmsHandler
{
public function __invoke(SendSms $command)
{
if ($this->usageService->exceedsQuota($command->getShopDomain())) {
// Update
}
}
View foo.php
<?php
return array(
'service_manager' => array(
'aliases' => array(
'Zend\Authentication\AuthenticationService' => 'doctrine.authentication.orm_default'
)
)
);
View gist:8439705
$config = [
'router' => [
'routes' => [
'zfr-oauth2-server' => [
'chain_routes' => [
[
'type' => 'Hostname',
'options' => [
'route' => 'connect.saas-metrics.localhost'
]
View foo.php
// Before:
return [
'slm_queue' => [
'worker' => [
'max_runs' => 500
],
'queue_manager' => [
'factories' => [
You can’t perform that action at this time.