A Pen by Stefan Baumgartner on CodePen.
This file contains 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
class Collection { | |
coll; | |
constructor(coll) { | |
this.coll = coll; | |
} | |
map(fn) { | |
return new MapCollection(this, fn); | |
} |
This file contains 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
type ResizeObserverBoxOptions = "border-box" | "content-box" | "device-pixel-content-box"; | |
interface ResizeObserverOptions { | |
box?: ResizeObserverBoxOptions; | |
} | |
interface ResizeObservation { | |
readonly lastReportedSizes: ReadonlyArray<ResizeObserverSize>; | |
readonly observedBox: ResizeObserverBoxOptions; | |
readonly target: Element; |
This file contains 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
function curry<T extends unknown[], U extends unknown[], V>( | |
f: (...ts: [...T, ...U]) => V, | |
...a: T | |
): (...b: U) => V { | |
return (...b) => f(...a, ...b); | |
} | |
const input = (a: number, b: string, c: boolean, d: symbol) => | |
[a, b, c, d] as const; | |
curry(input, 1, "123", true, Symbol())(); |
This file contains 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
type AllElements = { | |
'a': HTMLAnchorElement; | |
'div': HTMLDivElement; | |
'span': HTMLSpanElement; | |
'ul': HTMLUListElement; | |
'title': HTMLTitleElement; | |
'textarea': HTMLTextAreaElement; | |
'template': HTMLTemplateElement; | |
'tfoot': HTMLTableSectionElement; | |
'thead': HTMLTableSectionElement; |
This file contains 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
/** | |
* @typedef {Object} Article | |
* @property {string} title | |
* @property {number} price | |
* @property {number} vat | |
* @property {number} stock | |
* @property {string} description | |
*/ | |
/** @type {Article} */ | |
let article; |
This file contains 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
<input type="color" /> |
A Pen by Stefan Baumgartner on CodePen.
This file contains 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
/** | |
* Bluebird allows us to promisify existing Node.js | |
* technologies. So fs.writeFile and fs.readFile | |
* are usable with Promises. | |
* | |
* `fetch` fetches Ressources. This code fetches | |
* jQuery, and saves the responses body in a file | |
**/ | |
var gulp = require('gulp'); |
This file contains 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
var gulp = require('gulp'); | |
var source = require('vinyl-source-stream'); | |
var request = require('request'); | |
var merge = require('merge2'); | |
var concat = require('gulp-concat'); | |
var buffer = require('gulp-buffer'); | |
/** | |
* 1. We request the latest jQuery version from the jQuery CDN. The | |
* request package allows for streaming. What we get in return |
NewerOlder