Skip to content

Instantly share code, notes, and snippets.

View trys's full-sized avatar
🤓
🚀

Trys Mudford trys

🤓
🚀
View GitHub Profile
@trys
trys / package.json
Created April 10, 2019 19:02
Sergey - Package
{
"name": "sergey-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "sergey",
"dev": "sergey --watch"
},
"keywords": [],
@trys
trys / index.html
Last active April 29, 2019 12:47
Sergey - Import
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Our lil' website</title>
</head>
<body>
<sergey-import src="header" />
@trys
trys / header.html
Created April 10, 2019 18:54
Sergey - Header
<header>
<nav>
<a href="/">Home</a>
</nav>
</header>
@trys
trys / index.html
Last active April 10, 2019 18:53
Sergey - starting point
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Our lil' website</title>
</head>
<body>
<header>
<nav>
(function(key, maxWidth, padding, bg, color, url) {
var load = function (load) {
if (localStorage.getItem(key)) return;
var cookieBar = document.createElement('aside');
var size = window.innerWidth > 600 ? '15' : '12';
cookieBar.innerHTML = '<div style="max-width: ' + maxWidth + 'px; margin: 0 auto; position: relative;"><p style="width: calc(100% - 40px); max-width: 1025px; margin: 0; font-size: ' + size + 'px; line-height: 1.375;">By browsing this site, you are agreeing to our use of cookies. <a href="' + url + '" style="color: inherit; text-decoration: underline; margin-right: 10px;">Our Privacy Policy.</a></p><button style="background: none; border: none; box-shadow: none; padding: 0; cursor: pointer; position: absolute; right: 0; top: 0;" aria-label="Close cookie message" type="button"><svg width="16" height="15" viewBox="0 0 16 15" xmlns="http://www.w3.org/2000/svg"><g stroke="' + color + '" fill="none" fill-rule="evenodd" stroke-linecap="square"><path d="M.5.5l14.04 14.04M.5 14.5L14.5
@trys
trys / Thyme.js
Last active June 2, 2018 07:25
Dates without times
class Thyme {
constructor(raw) {
if (!raw) raw = this.format(this.offset(new Date()))
this.normalise(raw.toString().replace(/\//g, '-'))
}
offset(d) {
return new Date(d.getTime() + (d.getTimezoneOffset() * 60000))
}
@trys
trys / checkboxes.js
Created May 4, 2018 10:52
Netlify CMS Checkboxes
import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { Map } from 'immutable';
function valueToString(value) {
return value ? value.map(v => v.trim()).filter(v => v).join(',').replace(/,([^\s]|$)/g, ', $1') : '';
}
export default class CheckboxControl extends React.Component {
response.replace( /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "" )
@trys
trys / infinite-scroll.js
Created October 13, 2017 10:22
Infinite Scroll
(function InfiniteScroll(TRIGGER_WRAPPER, POSTS_WRAPPER) {
var triggerSelector = TRIGGER_WRAPPER + ' a';
var trigger = document.querySelector(triggerSelector);
var observer = new IntersectionObserver(function(entries) {
if (entries[0].isIntersecting) {
entries[0].target.click();
}
});
function attachHandlers() {
@trys
trys / functions.php
Last active September 27, 2016 08:24
Options
<?php
/**
* ACF options page
*/
function namespace_acf_settings() {
function_exists( 'acf_add_options_page' ) && acf_add_options_page(
array(
'menu_slug' => 'site-options',