Skip to content

Instantly share code, notes, and snippets.

View fabiensebban's full-sized avatar

Fabien Sebban fabiensebban

View GitHub Profile
@fabiensebban
fabiensebban / gist:0d0f1de7ae9b6e4d29105227d658c1c6
Created May 16, 2019 17:35
inventoryBulkAdjustQuantityAtLocation with variables
mutation ($inventoryItemAdjustments: [InventoryAdjustItemInput!]!, $locationId: ID!) {
inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $inventoryItemAdjustments, locationId: $locationId) {
inventoryLevels {
id
available
}
userErrors {
field
message
}
@fabiensebban
fabiensebban / gist:c92b088572c653d8253b6e4f3d00b2d2
Created May 16, 2019 17:35
inventoryBulkAdjustQuantityAtLocation with variables
mutation ($inventoryItemAdjustments: [InventoryAdjustItemInput!]!, $locationId: ID!) {
inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $inventoryItemAdjustments, locationId: $locationId) {
inventoryLevels {
id
available
}
userErrors {
field
message
}
@fabiensebban
fabiensebban / instructions.md
Last active April 13, 2022 17:57 — forked from olance/instructions.md
Script Shopify Plus permettant de désactiver les moyens de paiement Alma lorsque le panier est trop faible ou trop élevé, ou que le pays de livraison n'est pas la France

Ne fonctionne que pour les clients Shopify Plus, les clients Shopify "standard" n'ayant pas accès à l'app Script Editor.

Le code fourni a été généré avec l'outil Shopify Script Creator ; vous pouvez l'utiliser vous-mêmes pour créer des scénarios plus complexes si besoin.

Instructions

  1. Installez l'app Script Editor sur votre boutique
  2. Dans l'app ("Apps" dans la colonne de gauche puis "Script Editor"), cliquez sur le bouton "Create Script"
  3. Sélectionnez "Payment gateways" et "Blank template", puis cliquez sur "Create script"
@fabiensebban
fabiensebban / check_env_variable.rb
Created June 6, 2023 18:16
This script checks if SSM variables declared in the `template.yaml` file exist. If they do not exist, this script will create it for you.
require 'aws-sdk-ssm'
module Tasks::CheckEnvVariables
AVAILABLE_ENVS = %w[qa production].freeze
def self.perform
template = YAML.load_file('./template.yaml')
ssm_client = Aws::SSM::Client.new(
region: 'eu-west-3',
credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
@fabiensebban
fabiensebban / csv-to-json.php
Created August 28, 2023 14:37
CSV to JSON PHP
/*
File in mydata.csv is formatted as follow:
key1/key2,"value1"
key1/key2/key3,"value2"
key1/key2/key4,"value2"
*/
$file = fopen("mydata.csv", "r");
$data = fgetcsv($file);
@api_version = "2024-07"
@store_url = "TODO"
@api_key = "TODO"
@password = "TODO"
def graphql_request(query, variables = {})
query = { query: query, variables: variables }.to_json unless variables.empty?
url = URI.parse("https://#{@store_url}/admin/api/#{@api_version}/graphql.json")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true