Skip to content

Instantly share code, notes, and snippets.

@AndreaMorone
AndreaMorone / index.js
Last active August 29, 2025 08:21
Calculate Shopify Function Query Cost
const { parse } = require('graphql/language');
/**
* Calculates the cost of a GraphQL query based on its structure.
*
* @param {string} query - The GraphQL query to calculate the cost for.
* @param {boolean} [debug=false] - If true, additional debug information will be logged.
* @return {number} The total cost of the query.
*/
function calculateQueryCost(query, debug = true) {
@AndreaMorone
AndreaMorone / .htaccess
Created December 11, 2017 12:32 — forked from zackn9ne/.htaccess
.htaccess for Yoast XML Sitemaps to Work
# WordPress SEO - XML Sitemap Rewrite Fix
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index\.xml$ /index.php?sitemap=1 [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
</IfModule>
# END WordPress SEO - XML Sitemap Rewrite Fix
@AndreaMorone
AndreaMorone / SCSS.md
Created July 17, 2017 10:09 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@AndreaMorone
AndreaMorone / business-models.md
Created April 27, 2017 12:05 — forked from ndarville/business-models.md
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@AndreaMorone
AndreaMorone / hide-editor.php
Created September 9, 2016 11:22 — forked from ramseyp/hide-editor.php
Hide the content editor for certain pages in WordPress
<?php
/**
* Hide editor on specific pages.
*
*/
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.
/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs
@AndreaMorone
AndreaMorone / gist:81f647a0d5ef4382ebb4
Created November 18, 2015 17:35 — forked from nathanpitman/gist:4038248
Responsive 'insets' / 'negative offsets' for Twitter Bootstrap
.inset12 {
margin-left: -940px;
}
.inset11 {
margin-left: -860px;
}
.inset10 {
margin-left: -780px;
}