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
| <? | |
| # MIT license, do whatever you want with it | |
| # | |
| # This is my invoice.php page which I use to make invoices that customers want, | |
| # with their address on it and which are easily printable. I love Stripe but | |
| # their invoices and receipts were too wild for my customers on Remote OK | |
| # | |
| require_once(__DIR__.'/../vendor/autoload.php'); |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <title>Embed Test Site</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <style type="text/css"> | |
| .container { | |
| margin: 4rem auto; |
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 User < ApplicationRecord | |
| has_many :sessions, -> {order "created_at DESC"} | |
| def streak | |
| streak_count = 0 | |
| today = Time.now.to_date | |
| dates_array = self.sessions.map do | session | | |
| session.created_at.to_date |
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
| <? | |
| // this script receives a Stripe dispute / chargeback and: | |
| // | |
| // - immediately refunds the payment | |
| // - closes the user's account (in my DB, add your own code there) | |
| // | |
| // this is to automate dispute handling (because you never win a dispute on Stripe anyway) | |
| // and by refunding avoiding the chargeback fee | |
| // |
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
| /*! | |
| * Webflow: Front-end site library | |
| * @license MIT | |
| * Inline scripts may access the api using an async handler: | |
| * var Webflow = Webflow || []; | |
| * Webflow.push(readyFunction); | |
| */ | |
| /******/ (function(modules) { // webpackBootstrap | |
| /******/ // The module cache | |
| /******/ var installedModules = {}; |
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
| Kefir.merge([ | |
| Kefir.fromEvents(input, 'keyup'), | |
| Kefir.fromEvents(input, 'input'), | |
| Kefir.fromEvents(input, 'click'), | |
| Kefir.fromEvents(input, 'focus') | |
| ]) | |
| .takeUntilBy(elementDestroyedObservable) | |
| .debounce(100) | |
| .onValue(() => /* do some stuff */) |
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
| function pasteText({replacementText, cursorContext, activeQuery}: {replacementText: string; cursorContext: CursorContext; activeQuery: string;}){ | |
| // update text node content with replaced text | |
| const lastIndex = cursorContext.textBeforeCursor.lastIndexOf(activeQuery); | |
| cursorContext.textNode.textContent = cursorContext.textNodeContent.substring(0, lastIndex) + replacementText + cursorContext.textAfterCursor; | |
| const selection = document.getSelection(); | |
| if(!selection) return; | |
| // put cursor at the end of the replaced text | |
| const range = document.createRange(); |
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
| /* @flow */ | |
| /* this code heavily borrows from https://github.com/zurb/tribute */ | |
| export type CursorContext = { | |
| textNode: Node; | |
| textNodeParent: Node; | |
| textNodeContent: string; | |
| textBeforeCursor: string; | |
| textAfterCursor: string; |
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
| // Run this in the F12 javascript console in chrome | |
| // if a redirect happens, the page will pause | |
| // this helps because chrome's network tab's | |
| // "preserve log" seems to technically preserve the log | |
| // but you can't actually LOOK at it... | |
| // also the "replay xhr" feature does not work after reload | |
| // even if you "preserve log". | |
| window.addEventListener("beforeunload", function() { debugger; }, false) |