| Provider | Singleton | Instantiable | Configurable |
|---|---|---|---|
| Constant | Yes | No | No |
| Value | Yes | No | No |
| Service | Yes | No | No |
| Factory | Yes | Yes | No |
| Decorator | Yes | No? | No |
| Provider | Yes | Yes | Yes |
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
| module Moment = { | |
| type t; | |
| [@bs.send.pipe : t] external format : string => string = ""; | |
| [@bs.send.pipe : t] external utcOffset : string => t = ""; | |
| }; | |
| [@bs.module] external _moment : string => Moment.t = "moment"; | |
| let moment = (value) => _moment(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
| let unitConfig = Fela.Plugins.unit_config(~unit_="rem", ()); | |
| let extendPlugin = Fela.Plugins.extend; | |
| let embeddedPlugin = Fela.Plugins.embedded; | |
| let prefixerPlugin = Fela.Plugins.prefixer; | |
| let fallbackValue = Fela.Plugins.fallbackValue; |
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
| type t; | |
| type getStylesheetsHtmlMeth = {. "getStylesheetsHtml": [@bs.meth] (unit => unit)}; | |
| [@bs.val] external styletron_client_option : array(string) => t = ""; | |
| [@bs.module "styletron-client"] [@bs.new] external styletronClient : 'a => 'a = "default"; | |
| [@bs.module "styletron-server"] [@bs.new] | |
| external styletronServer : unit => getStylesheetsHtmlMeth = |
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
| type t; | |
| [@bs.obj] | |
| external renderer_options : | |
| ( | |
| ~plugins: array(t)=?, | |
| ~enhancers: array(t)=?, | |
| ~mediaQueryOrder: array(string)=?, | |
| ~supportQueryOrder: array(string)=?, | |
| ~selectorPrefix: string=?, |
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 * as path from 'path'; | |
| import * as ExtractTextPlugin from 'extract-text-webpack-plugin'; | |
| import * as AssetsPlugin from 'assets-webpack-plugin'; | |
| import * as CompressionPlugin from 'compression-webpack-plugin'; | |
| import * as CopyWebpackPlugin from 'copy-webpack-plugin'; | |
| import * as ManifestPlugin from 'webpack-manifest-plugin'; | |
| import * as webpack from 'webpack'; | |
| import { clientConfiguration, serverConfiguration } from 'universal-webpack'; | |
| import settings from './universal-webpack-settings'; |
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
| Search: | |
| var\s+(\w+)\s+\=\s+require\((("|')[a-zA-Z0-9\/\.-]+\3)\)\;? | |
| Replace: | |
| import $1 from $2; |
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 express from "express"; | |
| /** | |
| * Takes a route handling function and returns a function | |
| * that wraps it after first checking that the strings in | |
| * `reserved` are not part of `req.body`. Used for ensuring | |
| * create and update requests do not overwrite server-generated | |
| * values. | |
| */ | |
| function checkReservedParams(routeHandler, ...reserved) { |
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
| .video { position: relative; padding-bottom: 56.25%; /* 16:9 */ height: 0; } | |
| .video img { position: absolute; display: block; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; cursor: pointer; } | |
| .video:after { content: ""; position: absolute; display: block; | |
| background: url(play-button.png) no-repeat 0 0; | |
| top: 45%; left: 45%; width: 46px; height: 36px; z-index: 30; cursor: pointer; } | |
| .video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } | |
| /* image poster clicked, player class added using js */ | |
| .video.player img { display: none; } | |
| .video.player:after { display: none; } |
Or: Turning a function into a promise
So many times while learning how to use promises, or trying to use them in my Angular applications, I would discover pieces of functionality that needed to be a promise, but weren't a $resource (or one of it's derivates).
Most tutorials show a final result of something like this: