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
| const obs$ = Rx.Observable.create((observer) => { | |
| observer.next(1) | |
| // either: | |
| observer.error(new Error('404')) | |
| observer.complete() | |
| }) | |
| observable.subscribe( | |
| value => console.log(value), | |
| err => console.error(value), |
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
| // https://github.com/Offirmo/blog/blob/gh-pages/tosort/javascript-daily/mod-floating.md | |
| const floating = require('floating.js) | |
| floating({ | |
| content: '<span style="color: snow">❄</span>', | |
| number: 25, | |
| direction: 'reverse', | |
| size: [0.5, 2.5], | |
| }) |
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
| // Iterating on the UMD template from here: | |
| // https://github.com/umdjs/umd/blob/master/templates/returnExportsGlobal.js | |
| // But experimentally improving it so that it works for webpack 2 | |
| // UMD template from https://gist.github.com/Offirmo/ec5c7ec9c44377c202f9f8abcacf1061#file-umd-js | |
| (function (root, factory) { | |
| var LIB_NAME = 'Foo' | |
| if (typeof define === 'function' && define.amd) { |
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
| <link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/alertifyjs/alertify.js/v1.0.11/dist/css/alertify.css" /> | |
| <script src="https://cdn.rawgit.com/alertifyjs/alertify.js/v1.0.11/src/js/alertify.js"></script> | |
| <script src="https://unpkg.com/floating.js@2.6.3/floating.js"></script> | |
| <script> | |
| console.log('hello world') | |
| </script> | |
| <noscript>Your browser either does not support JavaScript, or has it turned off.</noscript> |
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
| // imports | |
| import { Random, Engine } from '@offirmo/random' | |
| import { | |
| State as MetaState, | |
| factory as meta_state_factory, | |
| } from '@oh-my-rpg/state-meta' | |
| // http://www.benmvp.com/learning-es6-enhanced-object-literals/ | |
| return { |
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
| // new | |
| return (...args) => { | |
| try { | |
| return handler.call(this, ...args); | |
| } catch(e) { | |
| return this.onError(e); | |
| } | |
| }; | |
| // old school |
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
| https://github.com/terkelg/facon | |
| // in Offirmo monorepo! | |
| function poll(predicate, options) { | |
| // early check to save an initial poll period | |
| let result = predicate(); | |
| if (result) | |
| return Promise.resolve(result); |
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
| import 'marky' | |
| const user_timing_measurement = (window as any).user_timing_measurement | |
| user_timing_measurement.mark('bootstrap') | |
| ... | |
| user_timing_measurement.stop('bootstrap') | |
| // https://www.html5rocks.com/en/tutorials/webperformance/basics/ |
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
| /* | |
| https://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/ | |
| http://bradfrost.com/blog/post/atomic-web-design/#atoms | |
| zqsmm.qiniucdn.com/data/20110511083224/index.html | |
| */ | |
| .block {} | |
| .block__element {} | |
| .block--modifier {} |
OlderNewer