Skip to content

Instantly share code, notes, and snippets.

James Koshigoe jameslk

Block or report user

Report or block jameslk

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 buy_x_with_items_discount.rb
# This Shopify Script provides a discount when the eligible item is found and the cart
# has more than one item.
ELIGIBLE_PRODUCT_ID = 111111111 # Specify which product ID creates a discount
DISCOUNT_AMOUNT = 0.2 # Set the discount amount here
has_product_in_cart = Input.cart.line_items.any? do |line_item|
line_item.variant.product.id == ELIGIBLE_PRODUCT_ID
end
@jameslk
jameslk / combo_discount.rb
Last active Jun 15, 2019
Shopify Scripts: Buy X, Y, and Z products together and get XX% off
View combo_discount.rb
ELIGIBLE_PRODUCT_IDS = [111111111, 22222222, 3333333333] # Specify which product IDs create a discount
DISCOUNT_AMOUNT = 0.2 # Set the discount amount here
cart_product_ids = Input.cart.line_items.map { |line_item| line_item.variant.product.id }
if ELIGIBLE_PRODUCT_IDS.all? { |product_id| cart_product_ids.include?(product_id) }
Input.cart.line_ites.each do |line_item|
discounted_price = line_item.line_price * (1.0 - DISCOUNT_AMOUNT)
line_item.change_line_price(discounted_price, message: "#{DISCOUNT_AMOUNT * 100}% off!")
end
@jameslk
jameslk / Equity.md
Created Mar 29, 2016 — forked from isaacsanders/Equity.md
Joel Spolsky on Equity for Startups
View Equity.md

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

@jameslk
jameslk / atom-shell-fullscreen.js
Last active Sep 29, 2015
Atom Shell Fullscreen Monkey Patch
View atom-shell-fullscreen.js
// To use this, import the Fullscreen class, instantiate it and call implementHtml5FullscreenApi().
import remote from 'remote';
export default class Fullscreen {
constructor() {
this.browserWindow = remote.getCurrentWindow();
this.elementPrototype = Element.prototype;
this._fullscreenElement = null;
You can’t perform that action at this time.