Skip to content

Instantly share code, notes, and snippets.

View karimmtarek's full-sized avatar

Karim Tarek karimmtarek

View GitHub Profile
@karimmtarek
karimmtarek / Make a Cuba Template.md
Created March 16, 2017 18:02 — forked from Patru/Make a Cuba Template.md
How I got to my Cuba template

Since I did not want to constantly re-invent the wheel I will write down my choices for putting together my Cuba template.

  1. Choose your favorite version of ruby and install it using rbenv (I happened to use MRI 2.2.3 at this point).
  2. create your template directory and CD into it.
  3. fix your ruby version using rbenv local 2.2.3 or somesuch
  4. create a github repository and follow the instructions for the README.md and the first commit.
  5. get a Gemfile from a running project and edit away the stuff I considered project specific
  6. run bundle install, takes a while, but looks nice, remember to add Gemfile.lock to git too
  7. create routes and config directories, want to put stuff in there
  8. create an initial Cuba route in routes/default.rb
@karimmtarek
karimmtarek / Cuba Setup.md
Created March 16, 2017 18:02 — forked from Patru/Cuba Setup.md
Setting up Cuba with Sequel, Fortitude, Capybara and Minitest

Setup for Cuba in a sample app

I recently read up quite some articles on microframworks and I liked the idea to try out Cuba instead of the regular Sinatra for a change. Here is what I ended up with.

First of all my Gemfile:

source "https://rubygems.org"
ruby "2.0.0"
@karimmtarek
karimmtarek / shopify_app.js
Created February 3, 2021 12:43
Shopify app JS SSR Turbolinks setup
// app/javascript/shopify_app/shopify_app.js
import { getSessionToken } from "@shopify/app-bridge-utils";
import $ from "jquery";
const SESSION_TOKEN_REFRESH_INTERVAL = 2000; // Request a new token every 2s
async function retrieveToken(app) {
window.sessionToken = await getSessionToken(app);
}
// JavaScript
let hidePage = () => {
let payload = {
object_type: 'page',
object_id: 123,
namespace: 'seo',
key: 'hidden',
value: 1,
value_type: 'number_integer'
};
@karimmtarek
karimmtarek / CLAUDE.md
Created March 5, 2026 21:18
Shopify theme frontend best practices as a CLAUDE.md file. Drop it in your project root and Claude Code follows Shopify conventions automatically.

Shopify Theme Development — Claude Code Guidelines

This file provides frontend best practices and conventions for Claude Code when working on any Shopify theme project. Follow these guidelines unless the project's README or a team member explicitly overrides them.


Project Structure

  • Follow the standard Shopify theme directory structure: assets/, config/, layout/, sections/, snippets/, templates/, locales/.
  • Never create directories outside this structure without explicit justification.