Skip to content

Instantly share code, notes, and snippets.

View jimwhimpey's full-sized avatar

Jim Whimpey jimwhimpey

View GitHub Profile
self.addEventListener('fetch', (e) => {
if (assetManifest.includes(e.request.url) {
e.respondWith(
caches
.open(cacheKey)
.then(cache => cache.match(e.request))
.then(response => {
if (response) return response;
return fetch(e.request);
});
@jimwhimpey
jimwhimpey / service-worker.js
Last active November 10, 2022 22:26
An example of our cachable asset manifest that gets inlined into the top of our service worker file during by the build
self.__serviceWorkerManifest= [
// This is the HTML file that we initial load, we normalize
// any Slack client URL to request this same file
{
url: "/boot/client.html",
hash: "52de82b6a380a284b31a6e7be0999050"
// Of course our JS and CSS assets are cached
}, {
url: "https://a.slack-edge.com/bv1-6-9b2646d/client-lazy-components.2ce886f.cache-gantry-1565714987.min.js",
hash: "2ce886f1b462f7437012"
@jimwhimpey
jimwhimpey / support.js
Last active April 27, 2016 00:28
Methods currently supported in Flickr's JavaScript SDK
flickr.request().media().post() // Uploading media
flickr.request().media(mediaID).get() // Fetching media
flickr.request().media().search("puppies").get() // Searching media
flickr.request().people(personID).media().get() // Fetching photostreams
flickr.request().people(personID).favorites().media().get() // Fetching favorites
flickr.request().people(personID).albums().get() // Fetching albums
flickr.request().media(mediaID).context(5).album(albumID).get() // Fetching album context
flickr.request().media(mediaID).context(5).photolist().get() // Fetching photolist context
flickr.request().media(mediaID).context(5).photosOf().get() // Fetching photos of context
flickr.request().media(mediaID).context(5).groupPool().get() // Fetching group pool context
@jimwhimpey
jimwhimpey / curl.sh
Created April 26, 2016 23:26
Flickr API cURL request
curl 'https://api.flickr.com/services/rest/' \
-d name=testing \
-d method=flickr.test.echo \
-d api_key=112d5d9e13e0c43e109233ff391f96ba
@jimwhimpey
jimwhimpey / photostream.js
Created April 26, 2016 23:25
Flickr SDK example photostream request
flickr
.request()
.people("40575690@N00") // ID or path alias
.media()
.get()
.then(function (response) {
// An array of media objects belonging to the person
}, function (err) {
// Any errors returned
});
@jimwhimpey
jimwhimpey / setup.js
Created April 26, 2016 23:09
Setting up the Flickr SDK
var Flickr = require('flickr');
var flickr = new Flickr({
"apiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"apiSecret": "xxxxxxxxxxxxxxxx",
"accessToken": "xxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
"accessTokenSecret": "xxxxxxxxxxxxxxxx"
});
@jimwhimpey
jimwhimpey / example-output.js
Created April 4, 2016 19:11
Example of justified-layout output
{
"containerHeight": 1269,
"boxes": [
{
"aspectRatio": 0.5,
"top": 10,
"width": 170,
"height": 340,
"left": 10
},
@jimwhimpey
jimwhimpey / input-example.js
Created April 4, 2016 18:43
Example of justified-layout input
[{
width: 400,
height: 300
},
{
width: 300,
height: 300
},
{
width: 250,

Header 1

Header 2

Header 3 ### (Hashes on right are optional)

Header 4

Header 5

sfasdfas

Markdown plus h2 with a custom ID ## {#id-goes-here}

Link back to H2

CREATE TABLE `products` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`merchant_id` int(11) DEFAULT NULL,
`merchant_name` text,
`merchant_product_id` text,
`name` text,
`url_merchant` text,
`url_affiliate` text,
`description` text,
`price_gbp` float DEFAULT NULL,