Skip to content

Instantly share code, notes, and snippets.

Jim Whimpey jimwhimpey

Block or report user

Report or block jimwhimpey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View example-service-worker-fetch.js
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 Aug 13, 2019
An example of our cachable asset manifest that gets inlined into the top of our service worker file during by the build
View service-worker.js
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 Apr 27, 2016
Methods currently supported in Flickr's JavaScript SDK
View support.js
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 Apr 26, 2016
Flickr API cURL request
View curl.sh
curl 'https://api.flickr.com/services/rest/' \
-d name=testing \
-d method=flickr.test.echo \
-d api_key=112d5d9e13e0c43e109233ff391f96ba
@jimwhimpey
jimwhimpey / photostream.js
Created Apr 26, 2016
Flickr SDK example photostream request
View photostream.js
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 Apr 26, 2016
Setting up the Flickr SDK
View setup.js
var Flickr = require('flickr');
var flickr = new Flickr({
"apiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"apiSecret": "xxxxxxxxxxxxxxxx",
"accessToken": "xxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
"accessTokenSecret": "xxxxxxxxxxxxxxxx"
});
@jimwhimpey
jimwhimpey / example-output.js
Created Apr 4, 2016
Example of justified-layout output
View example-output.js
{
"containerHeight": 1269,
"boxes": [
{
"aspectRatio": 0.5,
"top": 10,
"width": 170,
"height": 340,
"left": 10
},
@jimwhimpey
jimwhimpey / input-example.js
Created Apr 4, 2016
Example of justified-layout input
View input-example.js
[{
width: 400,
height: 300
},
{
width: 300,
height: 300
},
{
width: 250,
View gist:10765841

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

View gist:8866956
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,
You can’t perform that action at this time.