Python
def greet(name):
return f"Hello, {name}!"
greet('Fred')Mustache
Mustache.render("Hello, {{name}}!", { name: 'Fred' });| import { FC, useEffect } from 'react' | |
| type ScrollToOptionsPlusAllowed = ScrollToOptions & { allowed: boolean } | |
| /** | |
| * Hack to completely disable Next.js emulation of History.scrollRestoration. | |
| * Everywhere we want to scroll, we must add `allowed: true`. | |
| * @see https://github.com/vercel/next.js/issues/20951#issuecomment-970710409 | |
| */ | |
| export const ScrollToHack: FC = () => { |
| /** | |
| * @see https://docs.developers.optimizely.com/web/docs | |
| * | |
| * globalThis.optimizely?.get('state').getVariationMap() | |
| * { | |
| * 20015858428: { id: "20020533131", name: null, index: null }, | |
| * 20104572923: { id: "20121934640", name: "v1", index: 0 }, | |
| * } | |
| */ |
Python
def greet(name):
return f"Hello, {name}!"
greet('Fred')Mustache
Mustache.render("Hello, {{name}}!", { name: 'Fred' });| import DS from 'ember-data'; | |
| export default DS.RESTAdapter.extend({ | |
| buildURL() { | |
| return 'https://products.dollarshaveclub.com/cms/edge/v3/products.json'; | |
| }, | |
| }); |
| const debounce = require('debounce') | |
| const FastBootAppServer = require('fastboot-app-server') | |
| const Sane = require('sane') | |
| const distPath = '/app/dist' | |
| const server = new FastBootAppServer({ | |
| distPath, | |
| notifier: { | |
| subscribe(notify) { |
| import { moduleFor } from 'ember-qunit' | |
| import test from 'dummy/tests/ember-sinon-qunit/test' | |
| moduleFor('service:local-storage') | |
| const mockStore = { setItem() { }, removeItem() { } } | |
| test('when localStorage throws an exception', function testCatch(assert) { | |
| const service = this.subject() | |
| const stub = this.stub(mockStore, 'setItem').throws() |
| #ember-testing-container { | |
| position: absolute; | |
| background: white; | |
| bottom: 0; | |
| right: 0; | |
| width: 640px; | |
| height: 384px; | |
| overflow: auto; | |
| z-index: 9999; | |
| border: 1px solid #ccc; |
| import Ember from 'ember'; | |
| // @see http://emberjs.jsbin.com/beboga/edit?js,output | |
| export default function dynamicAlias(target, keyKey) { | |
| var prefix = target ? `${target}.` : ''; | |
| var dynamicAliasKey = `${prefix}${keyKey}_alias`; | |
| return Ember.computed(function() { | |
| var key = `${prefix}${this.get(keyKey)}`; | |
| Ember.defineProperty(this, dynamicAliasKey, Ember.computed.alias(key)); |
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| didInsertElement: function () { | |
| Ember.$('html, body').animate({ scrollTop: this.$().offset().top }, '2000'); | |
| } | |
| }); |
| Ember.Component.reopen({ | |
| actions: { | |
| bubble: function (action) { | |
| console.log('[Component action.bubble]', arguments); | |
| var temp = this.get(action); | |
| this.set(action, action); | |
| this.sendAction(action); | |
| this.set(action, temp); |