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
<?php declare( strict_types=1 ); | |
final class Billing_Date_Interval { | |
const INTERVAL_ONE_DAY = 'day'; | |
const INTERVAL_ONE_MONTH = 'month'; | |
const INTERVAL_ONE_YEAR = 'year'; | |
/** | |
* Add or subtract an interval to a 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
<?php | |
declare( strict_types=1 ); | |
/** | |
* Class to replace uses of `time()` or `new DateTime()` that allows | |
* overriding. | |
* | |
* This class should be used by everything in the billing system that needs to | |
* know the current time instead of calling `time()` or `new DateTime()`, etc. | |
* |
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
<?php declare( strict_types=1 ); | |
final class Billing_Date_Interval { | |
const INTERVAL_ONE_DAY = 'day'; | |
const INTERVAL_ONE_MONTH = 'month'; | |
const INTERVAL_ONE_YEAR = 'year'; | |
/** | |
* Add or subtract an interval to a 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
" Syntax plugins | |
Plug 'yuezk/vim-js' | |
Plug 'leafgarland/typescript-vim' | |
Plug 'peitalin/vim-jsx-typescript' | |
Plug 'MaxMEllon/vim-jsx-pretty' | |
Plug 'elzr/vim-json' | |
Plug 'moll/vim-node' | |
Plug 'cakebaker/scss-syntax.vim' | |
Plug 'hail2u/vim-css3-syntax' | |
Plug 'StanAngeloff/php.vim' |
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
syntax on | |
filetype on | |
filetype plugin on | |
filetype indent on | |
set hlsearch "highlight search matches | |
set autoindent "use previous line's indent level | |
set preserveindent " when reindenting try to preserve existing indentation as much as possible | |
set copyindent " when starting a new line use the indent of the previous line | |
set hidden "allow edited buffers to be hidden | |
set switchbuf=useopen "use existing buffer rather than opening a new one |
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
#!/bin/bash -e | |
TMP=.tsconfig-lint.json | |
cat >$TMP <<EOF | |
{ | |
"extends": "./tsconfig.json", | |
"include": [ | |
EOF | |
for file in "$@"; do | |
echo " \"$file\"," >> $TMP |
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 is a little tricky because we need to verify that text never appears, | |
// even after some time passes, so we use this slightly convoluted technique: | |
// https://stackoverflow.com/a/68318058/2615868 | |
async function verifyThatTextNeverAppears( text: string ) { | |
await expect( screen.findByText( text ) ).rejects.toThrow(); | |
} | |
// OR, a custom Jest matcher: | |
expect.extend( { |
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
<?php | |
/* | |
Plugin Name: Checkout Experiment | |
Description: An experimental WordPress.com checkout inside wp-admin | |
Author: Automattic | |
Version: 1.0 | |
Author URI: http://automattic.com | |
*/ | |
class CheckoutExperiment { |
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 React from "react"; | |
import { render } from "react-dom"; | |
// @ts-ignore | |
import wpcomFactory from 'wpcom'; | |
import wpcomProxyRequest from 'wpcom-proxy-request'; | |
import { | |
ShoppingCartProvider, | |
useShoppingCart, | |
} from "@automattic/shopping-cart"; | |
import { |
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
[alias] | |
backup-create = "!f() { git branch -f backup-$(git rev-parse --abbrev-ref HEAD) && echo 'Backup created. Use git backup-restore to restore.'; }; f" | |
backup-restore = "!f() { echo 'Are you sure you want to overwrite the current branch with the latest backup? This cannot be undone!'; select result in Yes No; do [[ $result == "Yes" ]] && git reset --hard backup-$(git rev-parse --abbrev-ref HEAD) && echo 'Backup restored.'; break; done; }; f" |
NewerOlder