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
| // Random 0 to max (excl) | |
| const random = (max) => Math.floor(Math.random() * max) | |
| // Random between (min incl, max excl) | |
| const random = (min, max) => Math.floor(Math.random() * (max - min) + min) | |
| // Fill array | |
| const arr = new Array(42).fill(0).map(() => random(1, 5)) | |
| // Remove duplicates from Array (tip: fallback using indexOf) | |
| let chars = ['A', 'B', 'A', 'C', 'B'] |
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 React from 'react' | |
| import { render, unmountComponentAtNode } from 'react-dom' | |
| /** | |
| * Creates a function that will render a React component into a target element and return an unmount function. | |
| * The entry point should be loaded async by a ReactLoader component to ensure code splitting. | |
| * @param component Root component to render | |
| */ | |
| export default <P>(component: React.ComponentType<P>) => (domElement: Element, props: P) => { | |
| render(React.createElement(component, props), domElement) |
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 { OnDestroy, OnInit } from '@angular/core' | |
| export type VoidFunction = () => void | |
| export interface ReactAppInit { | |
| default(component: Element, ...args: any[]): VoidFunction | |
| } | |
| export default class ReactLoaderComponent<T extends {}> implements OnInit, OnDestroy { | |
| constructor( |
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 data = { | |
| browser: { | |
| name: 'Chrome', | |
| version: '52.4.53.123', | |
| os: 'Mac' | |
| }, | |
| env: 'development', | |
| settings: { | |
| audioConference: { | |
| release: '2016-10-23 22:34:12' |
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
| export const keys = Object.freeze({ | |
| 'o/': '👋', | |
| '</3': '💔', | |
| '<3': '💗', | |
| '8-D': '😁', | |
| '8D': '😁', | |
| ':-D': '😁', | |
| '=-3': '😁', | |
| '=-D': '😁', | |
| '=3': '😁', |
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
| root = true | |
| [*] | |
| indent_style = tab | |
| indent_size = 4 |
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
| export const LogLevels = { | |
| log : 0, | |
| info : 1, | |
| warn : 2, | |
| error : 3 | |
| } | |
| function clone(arr) { | |
| return arr.map(a => JSON.parse(JSON.stringify(a))) | |
| } |
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
| class AtomFeed | |
| { | |
| private $xml; | |
| function __construct() | |
| { | |
| $this->xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" />'); | |
| } | |
| function setFeedHeader($title, $uri, $updated, $author_name, $author_email, $author_uri) |
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
| doctype xml | |
| rss(version="2.0", xmlns:atom="http://www.w3.org/2005/Atom") | |
| channel | |
| title= title | |
| link= url | |
| description= description | |
| language= language | |
| atom:link(href="#{ url }feed.xml", rel="self", type="application/rss+xml") | |
| each post, slug in public.blog._data | |
| if slug !== 'index' |
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
| export function create() { | |
| return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | |
| var r = Math.random() * 16 | 0, | |
| v = c === 'x' ? r : (r & 0x3 | 0x8); | |
| return v.toString(16); | |
| }); | |
| } | |
| var guid = require('js/guid'); |
NewerOlder