Skip to content

Instantly share code, notes, and snippets.

View SeanLF's full-sized avatar

Sean Floyd SeanLF

View GitHub Profile

Keybase proof

I hereby claim:

  • I am seanlf on github.
  • I am seanlf (https://keybase.io/seanlf) on keybase.
  • I have a public key ASCEHzpVt3QmZUcbzwcJyPiUHROJpAAKH6W-on8NUB6Bfwo

To claim this, I am signing this object:

@SeanLF
SeanLF / magnet.scpt
Created November 23, 2017 02:35
macOS app (applescript to handle opening magnet links with a CLI torrent client)
on open location magnetLink
tell application "iTerm"
tell current window
set theCommand to "bash -cil \"[[ -f ~/.bashrc ]] && . ~/.bashrc; webtorrent-hybrid download " & magnetLink & " && read\""
create tab with default profile command theCommand
end tell
end tell
end open location
@SeanLF
SeanLF / Ruby code review exercise | Summer '16.rb
Last active November 23, 2017 02:37
This code needs some loving - review the Ruby version and tell us what you would improve.
class ShopifyAPIClient
attr_accessor :shop_id
def initialize
@params = Hash.new
@params[:basic_auth] = {username: ENV['SECRET_API_KEY'], password: ''}
@api_url = "https://www.shopify.this.is.a.sample.com/"
end
def orders
@SeanLF
SeanLF / Shopicruit Winter 2016.js
Created December 30, 2015 00:43
Shopify developer intern application task solution [Winter 2016]
// Global variables
var PRODUCTS = {};
var CATEGORIES_SEARCHED_FOR = ['Wallet', 'Lamp'];
var TOTAL_PRICE = 0, TOTAL_WEIGHT = 0;
function get_price_for_all_variants_for_searched_categories(products){
// Filter all the products on the search
PRODUCTS = PRODUCTS.filter(function(product){
// Indicates if the product's category is found in the search list
return CATEGORIES_SEARCHED_FOR.indexOf(product.product_type) !== -1;
@SeanLF
SeanLF / Shopicruit Summer 2016 task 1.js
Last active September 2, 2016 21:04
Shopify developer intern application task solution [Summer 2016]
// Global variables
var CATEGORIES_SEARCHED_FOR = ['Keyboard', 'Computer'], MAXIMUM_WEIGHT/*in grams*/ = 100*1000;
function get_maximum_number_of_items_for_categories_searched_for_under_maximum_weight(variants, maximum_weight){
var current_weight = 0, subtotal = 0, items = {};
for(index = 0, variants_length = variants.length; index < variants_length; index++){
if(current_weight + variants[index].grams < maximum_weight){
items[variants[index].id] = 1;
current_weight += variants[index].grams;
} else{break;}