Skip to content

Instantly share code, notes, and snippets.

View pankajpatel's full-sized avatar
🎯
Focusing

Pankaj Patel pankajpatel

🎯
Focusing
View GitHub Profile
module.exports = (scope) => `<div class="tags">
${scope.tags.map(tag => `
${(() => {
tag.classes = (tag.classes || [])
.push(tag.name.matches('js') ? 'tag-blue' : '')
})()}
<a href="${tag.link}" class="${tag.classes.join(' ')}">${tag.name}</a>
`).join('')}
</div>`;
module.exports = (scope) => `<article>
<header>
<h1><a href="${scope.link}">${scope.title}</a></h1>
</header>
${require(`./tags.html.js`)(scope)}
<div>
<video src=${scope.video.src} autoplay="off"></video>
</div>
<div>${scope.video.description}</div>
<div>${scope.body}</div>
module.exports = (scope) => `<article>
<header>
<h1><a href="${scope.link}">${scope.title}</a></h1>
</header>
${require(`./tags.html.js`)(scope)}
<div>
${scope.body}
</div>
</article>`
module.exports = (scope) => `${scope.type ?
require(`${scope.type}.html.js`)(scope) : `
<h1>${scope.title || '---'}<h1>
<div>${scope.body || '...')</div>
`}`;
code,kbd,pre,samp{font-family: Inconsolata,Consolas,Menlo,Monaco,Courier New,monospace}code.prettyprint,pre.prettyprint{color: #fff;background-color: #444;padding: 1em;line-height: 1.5}pre.prettyprint.small{padding: .5em}pre .tooltip{position: relative;cursor: pointer}pre .tooltip .property{border-bottom: 1px dotted #fff}pre .tooltip .property .kwd{color: #508b88}pre .tooltip:hover:after{content: attr(data-tooltip);position: absolute;background: rgba(0,0,0,.85);padding: 5px 9px;color: #fff;border-radius: 3px;left: 0;top: 25px;width: 390px;z-index: 100}.pln{color: #000}@media screen{.str{color: #080}.kwd{color: #008}.com{color: #800}.typ{color: #606}.lit{color: #066}.clo,.opn,.pun{color: #660}.tag{color: #008}.atn{color: #606}.atv{color: #080}.dec,.var{color: #606}.fun{color: red}}@media print,projection{.str{color: #060}.kwd{color: #006;font-weight: 700}.com{color: #600;font-style: italic}.typ{color: #404;font-weight: 700}.lit{color: #044}.clo,.opn,.pun{color: #440}.tag{color: #006;font-weight: 700}.atn{color
@pankajpatel
pankajpatel / fetch-example-time2hack-com.markdown
Created October 31, 2017 07:59
Fetch Example: time2hack.com
@pankajpatel
pankajpatel / templateLiterals.js
Created October 23, 2017 09:53
Benefits of JavaScript Template Literals - Time to Hack; Read more at http://bit.ly/2ld9xYD
const topLevel = [
{ label: 'Home', url: '/home' },
{ label: 'Products', url: '/products' },
{ label: 'Services', url: '/services' },
{ label: 'About', url: '/about-us' },
{ label: 'Contact', url: '/contact-us' },
];
const social = [
{ label: '<i class="fa fa-facebook-square"></i>', url: 'https://facebook.com/time2hack' },
const generatePreviewData = (file, callback) => {
const fr = new FileReader();
fr.addEventListener('load', (e) => {
if(callback && typeof callback === 'function') callback(fr.result);
});
fr.readAsDataURL(file);
}
'use strict';
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({
host: 'localhost',
port: Number(process.argv[2]) || 8080
});
@pankajpatel
pankajpatel / automator_new_file.scpt
Created August 30, 2017 09:02 — forked from rarylson/automator_new_file.scpt
AppleScript to create a new file in Finder (to be used in Automator)
-- AppleScript to create a new file in Finder
--
-- Use it in Automator, with the following configuration:
-- - Service receives: no input
-- - In: Finder.app
--
-- References:
-- - http://apple.stackexchange.com/a/129702
-- - http://stackoverflow.com/a/6125252/2530295
-- - http://www.russellbeattie.com/blog/fun-with-the-os-x-finder-and-applescript