- Nov 2023
-
github.com github.com
-
Capybara.string(response.body)
const $html = Cypress.$(body)
-
- Mar 2023
-
stackoverflow.com stackoverflow.com
-
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)
-
- Sep 2022
-
stackoverflow.com stackoverflow.com
-
an equivalent of R's signif function in Ruby.
-
- Jan 2022
-
github.com github.com
-
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>
-
- Jun 2021
-
developer.mozilla.org developer.mozilla.orgProxy1
-
get: function(target, prop, receiver) { return "world"; }
-
- Apr 2021
-
stackoverflow.com stackoverflow.com
-
What is the equivalent of unbuffer program on Windows?
-
- Feb 2021
-
-
{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.
-
- Nov 2020
-
github.com github.com
-
imfeld.dev imfeld.dev
-
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.
-
- Oct 2020
-
github.com github.com
-
For event listeners we support the standard jsx naming convention onEventname (this is converted to on:eventname in svelte) as well.
-
-
svelte.dev svelte.dev
-
This is the Svelte version of this example: https://codesandbox.io/s/reactivity-react-responds-to-changing-props-forked-d2j44?file=/src/Label.js
-
-
github.com github.com
-
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.
-
- Sep 2020
-
sapper.svelte.dev sapper.svelte.dev
-
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.
-
-
shipshape.io shipshape.io
-
daveceddia.com daveceddia.com
-
-
React doesn’t provide something like ng-class, but there is a great library called classnames that does the same and more. Install it:
-