Skip to content

Instantly share code, notes, and snippets.

View gil--'s full-sized avatar
๐Ÿ’š
Building @ Shopify

Gil Greenberg gil--

๐Ÿ’š
Building @ Shopify
View GitHub Profile
@xmcp123
xmcp123 / shopify_delete_orders.js
Created March 1, 2018 01:35
Delete all orders from a shopify store admin panel.
//Run this from /admin/orders/. Paste it into the javascript console and press enter.
function delete_all()
{
l = $("[name*=order_ids_]");
console.log("Found "+l.length+" checkboxes");
for(i=0; i<l.length; i++)
{
name = $(l[i]).attr("name");
if(name.indexOf("order_ids_") > -1)
{
@Leland
Leland / sidebar.xml
Created July 18, 2017 15:35
Add sidebar to Magento 2 CMS page
<referenceContainer name="sidebar.additional">
<block class="Magento\Cms\Block\Block" name="replace_with_your_block_id">
<arguments>
<argument name="block_id" xsi:type="string">replace_with_your_block_id</argument>
</arguments>
</block>
</referenceContainer>
@mxstbr
mxstbr / Field.js
Last active February 23, 2022 07:39 — forked from hungrysquirrel/Field.js
Style Storybook with Styled Components
import React, { PropTypes } from 'react';
import styled from 'styled-components'
const Wrapper = styled.div`
// styles here that used to be for .test
`
const Label = styled.label`
// label styles here
`
@real34
real34 / front_commerce-magento_2_url.json
Created May 23, 2017 06:37
Pact specification for retrieving urls from a headless Magento2 (custom module)
{
"consumer": {
"name": "Front Commerce"
},
"provider": {
"name": "Magento 2 Url"
},
"interactions": [
{
"description": "A find request for entity with type category and id 6",
@magician11
magician11 / remove-paypal-gateway.rb
Last active May 18, 2022 07:03
How to remove the PayPal payment gateway in Shopify if a product is tagged with 'no-paypal'.
has_no_paypal_tag = Input.cart.line_items.any? { |line_item| line_item.variant.product.tags.include?('no-paypal') }
if has_no_paypal_tag
Output.payment_gateways = Input.payment_gateways.delete_if { |payment_gateway| payment_gateway.name.include?("PayPal") }
else
Output.payment_gateways = Input.payment_gateways
end
@gbabiars
gbabiars / ghost-to-gatsby.js
Created May 20, 2017 01:10
A script to migrate posts from Ghost's exported json to Gatsby
const fs = require('fs');
const path = require('path');
const moment = require('moment');
const json = require('./greg-babiarss-blog.ghost.2017-05-13.json');
json.data.posts
.filter(p => p.status === 'published')
.forEach(({title, slug, published_at: published, markdown}) => {
const date = moment(published).format('YYYY-MM-DD');
const content =
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 25, 2025 01:26
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@straker
straker / README.md
Last active April 22, 2025 21:19
Basic Snake HTML and JavaScript Game

Basic Snake HTML and JavaScript Game

Snake is a fun game to make as it doesn't require a lot of code (less than 100 lines with all comments removed). This is a basic implementation of the snake game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

  • Score
  • When the snake eats an apple, the score should increase by one. Use context.fillText() to display the score to the screen
@nadavspi
nadavspi / releaseNotes.js
Last active December 10, 2019 19:17
toddbc's release notes helpers
// All non-merge commits
reg = /^(.+?)(\n|$)/; ' * ' + Array.prototype.slice.call(document.querySelectorAll('.commit-message a')).map(el => el.title).filter(title => title && title.indexOf('Merge') !== 0).map(title => { var mm = title.match(reg); return mm && mm[1]; }).join("\n * ");
// Only merge commits
reg = /^[^#]+(#[0-9]+)[^\n]+\n\n((?:.|\n)+)$/; Array.prototype.slice.call(document.querySelectorAll('.commit-message a')).map(el => el.title).filter(title => title.indexOf('Merge') === 0).map(title => { var mm = title.match(reg); return mm && mm[2] + ' (' + mm[1] + ')'; }).join("\n * ");
@0-Sony
0-Sony / LayoutLoadBeforeObserver.php
Last active May 14, 2021 14:21
Magento 2 : Add Body Class using an observer
<?php
/**
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Phuong LE <[email protected]> <@>
* @copyright Copyright (c) 2017 Agence Soon (http://www.agence-soon.fr)
*/
namespace MyVendor\MyModule\Observer;