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 activeLocale = germanTranslations; | |
| activeLocale.user.address; // -> "Anschrift" |
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 germanTranslations = { | |
| user: { | |
| name: "Name", | |
| address: "Anschrift", | |
| gender: "Geschlecht", | |
| }, | |
| }; | |
| getTranslation("user.address"); // -> "Anschrift" |
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 User = { | |
| id: string; | |
| name: string; | |
| }; | |
| function getUser(): User { | |
| return { | |
| id: '123', | |
| namee: 'Tom Hanks', // misspelled | |
| // ^^^^^^^^^^^^^^^^^^ | |
| // Type '{ id: string; namee: string; }' is not assignable to type 'User'. |
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
| function getUser() { | |
| return { | |
| id: '123', | |
| namee: 'Tom Hanks', // misspelled | |
| }; | |
| } | |
| console.log(getUser().name); | |
| // ^^^^ | |
| // Property 'name' does not exist on type '{ id: string; namee: string; }'. Did you mean 'namee'? |
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 Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle', | |
| onFlatpickrChange(dates) { | |
| console.log(dates); | |
| }, | |
| flatpickrValue: new Date(), | |
| }); |
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 Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle', | |
| onFlatpickrChange(dates) { | |
| this.set('flatpickrValue', dates); | |
| }, | |
| flatpickrValue: new Date(), | |
| }); |
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
| define [ | |
| 'jquery' | |
| ], ($) -> | |
| # Fix Fixed is a work around an iOS bug involving fixed positioned elements. | |
| # Whenever the keyboard shows up, a fixed positioned element would reposition | |
| # itself randomly on the screen. This work around adds the .fix-fixed class to the | |
| # body in order to let fixed positioned elements change their position to absolute | |
| # while the keyboard is shown. | |
| # |
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 ReactWrapper extends Marionette.ItemView | |
| initialize: ({ @Element, props }) -> | |
| @model ?= new Backbone.Model(props) | |
| @listenTo @model, 'change', @updateProps | |
| render: => | |
| @component = React.render( React.createElement(@Element, @serializeData()), @el ) | |
| close: => React.unmountComponentAtNode(@el) |
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
| var MAX_TIME_TO_WAIT = 10; // ms | |
| // Tests for the eventual satisfaction of a set of expectations. Returns | |
| // a Promise that resolves if the given function runs without errors and | |
| // rejects if resolution cannot be obtained within `MAX_TIME_TO_WAIT` ms. | |
| function eventually(expectations) { | |
| var timeStarted = Date.now(); | |
| new Promise(function (resolve, reject) { | |
| function testExpectationsAndResolve() { | |
| try { |
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
| '.source.js': | |
| 'React.PropTypes.': | |
| 'prefix': 'rpt' | |
| 'body': 'React.PropTypes.${1},${2}' | |
| 'React.PropTypes.string': | |
| 'prefix': 'rpts' | |
| 'body': 'React.PropTypes.string${1:.isRequired},${2}' | |
| 'React.PropTypes.object': | |
| 'prefix': 'rptobj' | |
| 'body': 'React.PropTypes.object${1:.isRequired},${2}' |
NewerOlder