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
| // USAGE: | |
| // | |
| // This script is supposed to be used with `jscodeshift`. Here is how you would invoke it: | |
| // $ jscodeshift -t add-unit-true-to-ember-tests.js --fn=moduleForComponent path/to/unit/tests/ | |
| // | |
| // The `--fn` argument above can be changed to `moduleFor`, `moduleForModel`, etc. | |
| module.exports = function transform(file, api, options) { | |
| var j = api.jscodeshift; | |
| var fn = options.fn || 'moduleForComponent'; |
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, { Component, PropTypes as T } from 'react' | |
| /** | |
| * Helper component for rendering custom file inputs. It renders a label with an invisible | |
| * file input. The given `className` will be applied to the label. | |
| */ | |
| export default class FileInput extends Component { | |
| static propTypes = { | |
| allowedTypes: T.array, | |
| className: T.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
| /** | |
| * ./node_modules/.bin/postcss -c postcss.config.js -d munged/ prod/core/assets/*.css | |
| */ | |
| // postcss.config.js | |
| module.exports = { | |
| plugins: [ | |
| require('./munge'), | |
| ] | |
| } |
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
| #!/usr/bin/env bash | |
| set -e | |
| MEM_LIMIT=$1 # First argument | |
| CMD=${@:2} # Everything else | |
| echo "Memory limit set at: $MEM_LIMIT KB" | |
| echo "Running and monitoring: '$CMD'" | |
| eval "$CMD &" | |
| CMD_PID=$! |
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 fs from 'fs' | |
| // The symbols shouldn't be exported so that `module` remains an opaque object. | |
| const MODULE_PATH = Symbol('module.path'); | |
| const MODULE_VIRTUAL_CONTENT = Symbol('module.virtualContent'); | |
| export function createModule(path) { | |
| return { [MODULE_PATH]: path, [MODULE_VIRTUAL_CONTENT]: null }; | |
| } |
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
| // index.js | |
| ReactDOM.render(<App />, root); | |
| // components/app.js | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <> | |
| <h1>My App</h1> | |
| <ConverterForm /> |
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'; | |
| const { computed } = Ember; | |
| export default Ember.Component.extend({ | |
| tagName: '', | |
| text: computed.oneWay('todo.text'), | |
| json: computed('todo.{id,text}', function() { | |
| return JSON.stringify(this.get('todo')); | |
| }), |
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
| enum MyEnum { | |
| e1, | |
| e2, | |
| e3, | |
| } | |
| String getString(MyEnum value) { | |
| switch (value) { | |
| case MyEnum.e1: | |
| return 'e1'; |
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
| void main() { | |
| final double x = 10.0; | |
| print(x.runtimeType); // Prints "int" | |
| } |
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
| bool foo() { | |
| Future.value(10).then((_) { | |
| return true; | |
| }).catchError((_) { | |
| return false; | |
| }); | |
| } | |
| void main() { | |
| print(foo()); |
OlderNewer