Skip to content

Instantly share code, notes, and snippets.

View sanjsanj's full-sized avatar

Sanjay Purswani sanjsanj

View GitHub Profile
<amp-img src="https://loremflickr.com/300/300/architecture" alt="An image"
layout="responsive" width="1.6" height="1">
</amp-img>
<amp-layout layout="fixed-height" height="200" class="yellow">
<amp-fit-text layout="fill">
amp-layout component and attribute
</amp-fit-text>
</amp-layout>
<amp-layout layout="fill" class="green">
</amp-layout>
<!DOCTYPE html>
<html lang="en" ⚡>
<head>
...
<style amp-custom>
body {
padding: 12px;
}
</style>
</head>
<!DOCTYPE html>
<html lang="en" ⚡>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<link rel="canonical" href="thispage.html">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>/* full amp.css style rules */</style>
<noscript><style amp-boilerplate>/* minimal amp-noscript.css style rules */</style></noscript>
</head>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-carousel"
src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
</head>
<body>
<h1>An amp-img and an amp-carousel</h1>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
<h1>Just a basic built-in amp-img</h1>
<amp-img src="https://loremflickr.com/300/200/architecture"
// How to persist the React Redux state store to the browser's localStorage
// Code taken from Dan Abramov's video
// https://egghead.io/lessons/javascript-redux-persisting-the-state-to-the-local-storage
/**
localStorage.js
*/
export const loadState = () => {
try {
const serializedState = localStorage.getItem('state');
<!DOCTYPE html>
<html lang="en">
<head>
<title>matches vs closest</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>