This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrdersCreateJob < ActiveJob::Base | |
def create_usage_charge(product_name, price_to_merchant) | |
usage_charge = ShopifyAPI::UsageCharge.new(description: product_name, price: price_to_merchant.to_f) | |
recurring_application_charge = ShopifyAPI::RecurringApplicationCharge.current | |
usage_charge.prefix_options = { recurring_application_charge_id: recurring_application_charge.id } | |
usage_charge.save | |
end | |
def perform(shop_domain:, webhook:) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- html:5 --> | |
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<meta charset='UTF-8'> | |
<title></title> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):018:0> Product.where("LOWER(name) LIKE LOWER(?)", "%dissecting%") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var browserSync = require('browser-sync').create(); | |
var reload = browserSync.reload; | |
gulp.task('serve', function() { | |
browserSync.init({ | |
server: { | |
baseDir: "./" | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:prettier#autoformat = 0 | |
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue PrettierAsync |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/.vim/bundle | |
git clone https://github.com/prettier/vim-prettier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Use Vim settings, rather then Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
" source ~/.vimrc.before if it exists. | |
if filereadable(expand("~/.vimrc.before")) | |
source ~/.vimrc.before | |
endif | |
" ================ General Config ==================== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lineup: | |
def __init__(self, players): | |
self.players = players | |
self.last_player_index = (len(self.players) - 1) | |
def __iter__(self): | |
self.n = 0 | |
return self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import reduce | |
# def manual_exponent(num, exp): | |
# computed_list = [num] * exp | |
# return (reduce(lambda total, element: total * element, computed_list)) | |
# | |
# | |
# print(manual_exponent(2, 3)) | |
# print(manual_exponent(10, 2)) | |
# print(manual_exponent(3, 3)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from time import sleep | |
for i in range(100): | |
file_builder = open("logger.txt", "a+") | |
file_builder.write(f'{datetime.datetime.now()}\n') | |
file_builder.close() | |
sleep(2.0) |