Instantly share code, notes, and snippets.
jimwhimpey /example-service-worker-fetch.js
CreatedAugust 27, 2019 20:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| 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)returnresponse; | |
| returnfetch(e.request); | |
| }); |
jimwhimpey /service-worker.js
Last activeNovember 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 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| 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 /support.js
Last activeApril 27, 2016 00:28
Methods currently supported in Flickr's JavaScript SDK This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| curl'https://api.flickr.com/services/rest/' \ | |
| -d name=testing \ | |
| -d method=flickr.test.echo \ | |
| -d api_key=112d5d9e13e0c43e109233ff391f96ba |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| 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 | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| varFlickr=require('flickr'); | |
| varflickr=newFlickr({ | |
| "apiKey":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", | |
| "apiSecret":"xxxxxxxxxxxxxxxx", | |
| "accessToken":"xxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx", | |
| "accessTokenSecret":"xxxxxxxxxxxxxxxx" | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| { | |
| "containerHeight":1269, | |
| "boxes":[ | |
| { | |
| "aspectRatio":0.5, | |
| "top":10, | |
| "width":170, | |
| "height":340, | |
| "left":10 | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| [{ | |
| width:400, | |
| height:300 | |
| }, | |
| { | |
| width:300, | |
| height:300 | |
| }, | |
| { | |
| width:250, |
jimwhimpey /gist:10765841
Last activeApril 25, 2016 18:11
jimwhimpey /gist:8866956
CreatedFebruary 7, 2014 17:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| CREATETABLE `products` ( | |
| `id`int(10) unsignedNOT NULL AUTO_INCREMENT, | |
| `merchant_id`int(11) DEFAULTNULL, | |
| `merchant_name`text, | |
| `merchant_product_id`text, | |
| `name`text, | |
| `url_merchant`text, | |
| `url_affiliate`text, | |
| `description`text, | |
| `price_gbp` float DEFAULTNULL, |
NewerOlder