Skip to content

Instantly share code, notes, and snippets.

@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));
}
}
export default function ChildApp() {
return html`<div>How's it going now?</div>`;
}
@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=
@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]}`)
<!DOCTYPE html>
<html>
<head>
<title>My Project</title>
</head>
<body>
<h1>Test</h1>
</body>
</html>
@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',
@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 / same-height.css
Created September 27, 2017 17:20
Same height slides in swiper
.slide {
align-self: stretch;
height: unset;
}
@rob-gordon
rob-gordon / main.js
Last active September 15, 2017 18:23
clean dom-based routing es 6
/* ========================================================================
* Based on http://goo.gl/EUTi53 by Paul Irish
* ======================================================================== */
(function($) {
var Routes = {
common: {
init: () => {},
finalize: () => {}
},
@rob-gordon
rob-gordon / get_partial.php
Created September 11, 2017 20:10
get partial
function get_partial($path, $args = false) {
/* Set any variables */
if ($args && gettype($args) == 'array') {
foreach($args as $key => $value) {
$$key = $value;
}
}
include(locate_template('partials/'.$path.'.php'));