Skip to content

Instantly share code, notes, and snippets.

@rob-gordon
rob-gordon / same-height.css
Created September 27, 2017 17:20
Same height slides in swiper
.slide {
align-self: stretch;
height: unset;
}
@rob-gordon
rob-gordon / flex-grid.scss
Last active October 2, 2017 21:48
flex-grid and skinny breakpoint
body * {
box-sizing: border-box;
}
@mixin breakpoint($size) {
@if type-of($size) == "string" {
@media (min-width: map-get($breakpoints, $size)) {
@content;
}
} @else {
@rob-gordon
rob-gordon / rest_route.php
Created October 19, 2017 14:34
Quick custom wp rest route
/* Rest Routes */
function theme_data() {
$obj = [];
$obj["site_url"] = get_site_url();
return $obj;
}
add_action( 'rest_api_init', function () {
register_rest_route( 'theme', 'data', array(
'methods' => 'GET',
<!DOCTYPE html>
<html>
<head>
<title>My Project</title>
</head>
<body>
<h1>Test</h1>
</body>
</html>
@rob-gordon
rob-gordon / index.js
Created August 2, 2019 17:52
WP Repo Init
#!/usr/bin/env node
console.log(`You want to call your project: ${process.argv[2]}`)
@rob-gordon
rob-gordon / .env
Last active August 10, 2019 10:38
WP Repository Init Bash
DB_HOST=
DB_USER=
DB_PASSWORD=
DB_PORT=3306
DB_NAME=
export default function ChildApp() {
return html`<div>How's it going now?</div>`;
}
@rob-gordon
rob-gordon / fluid text with clamp
Last active July 13, 2020 21:31
function for fluid text with clamp
/*
Before
html {
font-size: 16px;
}
@media screen and (min-width: 320px) {
html {
font-size: calc(16px + 6 * ((100vw - 320px) / 680));
}
}
@rob-gordon
rob-gordon / await.ts
Created November 11, 2020 20:28
Unwrap promises and thenables recursively
// From https://stackoverflow.com/questions/48011353/how-to-unwrap-type-of-a-promise/57364353#57364353
type Await<T> = T extends PromiseLike<infer U> ? Await<U> : T
@rob-gordon
rob-gordon / machine.js
Last active December 1, 2020 13:21
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions