Skip to content

Instantly share code, notes, and snippets.

@adewale
adewale / gist:ee4a5cd1200e1bacefde4914fadff1c7
Created November 21, 2020 15:30
Note in Reader bookmarklet
javascript:var b=document.body;var GR________bookmarklet_domain='http://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='http://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}
@adewale
adewale / gist:43e9be1e145b65774d2a05aa40a92607
Created May 29, 2020 22:47
Converting Twitter archive into a human readable list of epigrams
=Convert javascript data into JSON
sed -e 's/window.YTD.tweet.part0 = //' ./data/tweet.js > ./data/tweet.json
=Convert comma-delimited JSON into newline-delimited JSON
cat data/tweet.json | jq -c '.[]' > newline.json
=Extract all the tweets that match the desired format
grep 'Theory:' newline.json > theories.json
= Extract the text and URL of each matching tweet. This is where we lose data because some tweets contain newlines (verify by comparing the number of tweets in both files) or because some tweets are retweets.
@adewale
adewale / gist:b5da770d99784b6558221e20c6b8c5be
Created September 9, 2016 09:27
amp-user-notification on express.co.uk that uses relative URLs and will be broken when https://github.com/ampproject/amphtml/issues/4537 gets changed
<amp-user-notification data-dismiss-href="/setcookielaw" data-show-if-href="/cookielaw?timestamp=TIMESTAMP" id="amp-user-cookie" layout=nodisplay>
<div>
<button on="tap:amp-user-cookie.dismiss">Accept Cookies</button>
By continuing to use the site, you agree to the use of cookies. You can find out more by following <a href="https://www.express.co.uk/cookie-policy/amp" target="_blank">this link</a>
</div>
</amp-user-notification>
@adewale
adewale / gist:6e2baa8fdea65108b257fe9fbdae3b77
Created August 23, 2016 15:10
Common misconceptions about Progressive Web Apps
Common misconceptions about Progressive Web Apps
They have to be SPAs.
They have to live at pwa.*.com
They have to be mobile only.
They're not allowed to be responsive.
They have to use material design.
They only work in chrome.
They don't work in safari or on iOS.
They have to look like your android app.
package main
import (
"fmt"
"time"
"github.com/hako/durafmt"
)
func main() {
start := time.Date(2000, time.January, 1, 0,0,0,0,time.UTC)
@adewale
adewale / gist:125f0cb2cb46b6af916a2178064efcc8
Created May 21, 2016 15:21
How to use the Google AMP URL API
curl -X POST -H "Content-Type: application/json" -H "X-Goog-Api-Key: FAKE_API_KEY" -d "{urls: ['http://www.theguardian.com/artanddesign/2010/oct/26/eames-furniture-team-charles-ray', 'http://www.theguardian.com/artanddesign/2015/aug/09/millennium-mills-docklands-london-developers-catch-up-last-relic', 'http://www.buzzfeed.com/alexfinnis/places-in-london-every-instagram-lover-needs-to-visit', 'http://www.buzzfeed.com/christinalan/come-eat-dessert-with-me-forever-and-ever', 'http://www.theverge.com/2015/7/20/9002721/the-mobile-web-sucks', 'http://www.theverge.com/2016/5/20/11720352/netflix-gilmore-girls-new-episodes-title-poster', 'http://www.bbc.co.uk/news/election-us-2016-35694116', 'http://www.bbc.com/news/business-36301378']}" "https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet"
{
"ampUrls": [
{
"originalUrl": "http://www.bbc.com/news/business-36301378",
"ampUrl": "http://www.bbc.co.uk/news/amp/36301378",
"cdnAmpUrl": "https://cdn.ampproject.org/c/www.bbc.co.uk/news/
@adewale
adewale / buzzfeed amp-twitter usage
Created March 25, 2016 15:57
Buzzfeed generating invalid amp-twitter markup
<amp-twitter data-tweetid=540105574332248064 data-conversation="none" width="600" height="221" layout="responsive"></amp-twitter>
<figcaption class="subbuzz__caption">
<div class="subbuzz__description
">
<p><blockquote class="tweet"><img src=""><a><img src="http://pbs.twimg.com/profile_images/525241125184233472/gvhy-V_q_normal.jpeg">Ciara Knight@Ciara_Knight</a><a>Follow</a><p class="tweet_text entry-title">The postman told me he's off to Spain tomorrow so I asked was he going to Parcelona and he ignored what I believe to be my best joke of 2014</p><a>11:29 AM - 03 Dec 14</a><a>Reply</a><a>Retweet</a><a>Favorite</a></blockquote></p>
</div></figcaption>
@adewale
adewale / amplist.example.html
Created January 5, 2016 16:16
Valid example of amp-list
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<title>amp-list examples</title>
<link rel="canonical" href="$SOME_URL" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style>body {opacity: 0}</style><noscript><style>body {opacity: 1}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script>
@adewale
adewale / AndroidManifest.xml
Created September 29, 2015 18:28
Excerpt of example an Android Manifest file
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="applinkingexperiment.appspot.com" android:scheme="http"/>
<data android:host="applinkingexperiment.appspot.com" android:scheme="https"/>
</intent-filter>
@adewale
adewale / assetlinks.json
Created September 29, 2015 18:23
Example assetlinks.json