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
| describe "make_dish_from_left_over" do | |
| context "with dishes that are served cold" do | |
| # before: set up cold dishes | |
| # ... | |
| # end | |
| context "seasoning available" do | |
| # before: set up seasoning | |
| # ... | |
| # end | |
| expect(add_seasoning).to be_truthy |
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 RichText from "../controls/rich_text"; | |
| const SavingState = Object.freeze({ | |
| NOT_SAVED: 0, | |
| SAVING: 1, | |
| SAVED: 2 | |
| }); | |
| class TextQuestion extends React.Component { | |
| constructor(props) { |
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 { debounce } from "lodash"; | |
| import RichText from "../controls/rich_text"; | |
| ... | |
| class TextQuestion extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.update = debounce(this._update.bind(this), 500); | |
| } |
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 array = [ | |
| {name: "Minh", age: 20}, | |
| {name: "Brian", age: 22}, | |
| {name: "Hugo", age: 12}, | |
| {name: "Zelda", age: 56}, | |
| {name: "Simon", age: 7} | |
| ]; | |
| const nameToFind = "Hugo"; | |
| const personToReplace = {name: "Ali", age: 34}; |
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 name = "com"; | |
| let i = 1; | |
| const radioDevice = { | |
| numberOfComs: 3, | |
| [name + "_" + i++]: "port 4556", | |
| [name + "_" + i++]: "socket 12", | |
| [name + "_" + i++]: "socket 15", | |
| }; |
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 key1 = "make"; | |
| const key2 = "model; | |
| const newObj = { | |
| year: 2020, | |
| [key1]: "toyota" | |
| [key2]: "prius" | |
| } |
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
| Rails.application.routes.draw do | |
| # ... | |
| draw :v1 | |
| draw :v2 | |
| # ... | |
| end |
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 generateAlphabets() { | |
| var alphabets = []; | |
| var start = 'A'.charCodeAt(0); | |
| var last = 'Z'.charCodeAt(0); | |
| for (var i = start; i <= last; ++i) { | |
| alphabets.push(String.fromCharCode(i)); | |
| } | |
| return alphabets.join(''); | |
| } |
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 AnimalSerializer < ActiveModel::Serializer | |
| def initialize(object, options) | |
| if options[:type] == 'giraffe' | |
| self.class.attributes :skin_pattern, :leg_length | |
| else | |
| self.class.attributes :number_of_legs | |
| end | |
| super(object, options) | |
| end | |
| ... |
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
| //AngularJS app | |
| .config( function myAppConfig ($locationProvider) { | |
| $locationProvider.html5Mode(true); | |
| ... | |
| } |