Capybara.string(response.body)
const $html = Cypress.$(body)
Capybara.string(response.body)
const $html = Cypress.$(body)
As an aside, I think I now prefer this technique to Python for at least one reason: passing arguments to the decorator method does not make the technique any more complex. Contrast this with Python: <artima.com/weblogs/viewpost.jsp?thread=240845>
def document(f): def wrap(x): print "I am going to square", x f(x) return wrap @document def square(x): print math.pow(x, 2) square(5)
an equivalent of R's signif function in Ruby.
Instead of render props, we use Svelte's slot props: // React version <Listbox.Button> {({open, disabled} => /* Something using open and disabled */)} </Listbox.Button> <!--- Svelte version ---> <ListboxButton let:open let:disabled> <!--- Something using open and disabled ---> </ListboxButton>
Analogous structures have the potential to reveal what selective pressures led us to develop language
it's rly useful to study analogous traits, as we can use them to test evolutionary theories to do with function. we can't do this with homologous structures, bc the change would have come from one common ancestor (and so would just be one data point, even if it affected millions of species)
FoxP2 governs oral and facial development
the same gene exists in birds - it also plays a role in their vocal learning. rly interesting example of an analogous trait & def not something i expected !!
get: function(target, prop, receiver) { return "world"; }
What is the equivalent of unbuffer program on Windows?
{a: 1, b: 2, c: 3, d: 4} => {a:, b:, **rest} # a == 1, b == 2, rest == {:c=>3, :d=>4}
equivalent in javascript:
{a, b, ...rest} = {a: 1, b: 2, c: 3, d: 4}
Not a bad replacement for that! I still find javascript's syntax a little more easily readable and natural, but given that we can't use the same syntax (probably because it would be incompatible with existing syntax rules that we can't break for compatibility reasons, unfortunately), this is a pretty good compromise/solution that they've come up with.
Converting Angular components into Svelte is largely a mechanical process. For the most part, each Angular template feature has a direct corollary in Svelte. Some things are simpler and some are more complex but overall it's pretty easy to do.
For event listeners we support the standard jsx naming convention onEventname (this is converted to on:eventname in svelte) as well.
This is the Svelte version of this example: https://codesandbox.io/s/reactivity-react-responds-to-changing-props-forked-d2j44?file=/src/Label.js
They even named the main file react.js
so when converting/migrating components from React you could (at least some of the time, perhaps) simply leave some of the imports as-is:
import {createHooks, useRef} from './react';
The $: can also be used to trigger effects.
We can run effects when some data changes using watchEffect - it takes a function that runs whenever a reactive value used inside changes.
page components can have an optional preload function that will load some data that the page depends on. This is similar to getInitialProps in Next.js or asyncData in Nuxt.js.
React doesn’t provide something like ng-class, but there is a great library called classnames that does the same and more. Install it: