- Dec 2023
-
www.reddit.com www.reddit.com
- Jun 2023
-
bugzilla.mozilla.org bugzilla.mozilla.org
Tags
Annotators
URL
-
-
github.com github.com
- May 2023
-
github.com github.com
-
jsdoc /* * @pattern /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*)/ */
Tags
Annotators
URL
-
- Mar 2023
-
www.erlang.org www.erlang.org
-
github.com github.com
Tags
Annotators
URL
-
-
github.com github.com
-
z-pattern-matching.github.io z-pattern-matching.github.io
-
- Matches by Object property ```js const { matches } = require('z')
const person = { name: 'Maria' } matches(person)( (x = { name: 'John' }) => console.log('John you are not welcome!'), (x) => console.log(
Hey ${x.name}, you are welcome!
) )- Matches by type or instances
js const { matches } = require('z')const result = matches(1)( (x = 2) => 'number 2 is the best!!!', (x = Number) =>
number ${x} is not that good
, (x = Date) => 'blaa.. dates are awful!' )console.log(result) // output: number 1 is not that good
- Matches Array content
js const { matches } = require('z')matches([1, 2, 3, 4, 5])( (a, b, c, tail) => 'a = 1, b = 2, c = 3, tail = [4, 5]'<br /> )
matches([1, 2])( (a, tail) => 'a = 1, tail = [2]'<br /> )
matches([1])( (a, b, tail) => 'Will not match here', (a = 2, tail = []) => 'Will not match here', (a = 1, tail) => 'Will match here, tail = []' ) ```
- Powerful recursive code which will remove sequential repeated items from Array ```js const { matches } = require('z')
const compress = (numbers) => { return matches(numbers)( (x, y, xs) => x === y ? compress([x].concat(xs)) : [x].concat(compress([y].concat(xs))), (x, xs) => x // stopping condition ) }
compress([1, 1, 2, 3, 4, 4, 4]) //output: [1, 2, 3, 4] ```
Tags
Annotators
URL
-
-
www.proposals.es www.proposals.es
-
js match (res) { if (isEmpty(res)) { … } when ({ pages, data }) if (pages > 1) { … } when ({ pages, data }) if (pages === 1) { … } else { … } }
js match (arithmeticStr) { when (/(?<left>\d+) \+ (?<right>\d+)/) as ({ groups: { left, right } }) { process(left, right); } when (/(?<left>\d+) \+ (?<right>\d+)/) { process(left, right); } // maybe? else { ... } }
```js class Name { static Symbol.matcher { const pieces = matchable.split(' '); if (pieces.length === 2) { return { matched: true, value: pieces }; } } }
match ('Tab Atkins-Bittner') { when (^Name with [first, last]) if (last.includes('-')) { … } when (^Name with [first, last]) { … } else { ... } } ```
js const res = await fetch(jsonService) match (res) { when ({ status: 200, headers: { 'Content-Length': s } }) { console.log(`size is ${s}`); } when ({ status: 404 }) { console.log('JSON not found'); } when ({ status }) if (status >= 400) { throw new RequestError(res); } };
```js function todoApp(state = initialState, action) { return match (action) { when ({ type: 'set-visibility-filter', payload: visFilter }) { ({ ...state, visFilter }); } when ({ type: 'add-todo', payload: text }) { ({ ...state, todos: [...state.todos, { text, completed: false }] }); } when ({ type: 'toggle-todo', payload: index }) { const newTodos = state.todos.map((todo, i) => { return i !== index ? todo : { ...todo, completed: !todo.completed }; });
({ ...state, todos: newTodos, }); } else { state } // ignore unknown actions
} } ```
jsx <Fetch url={API_URL}> {props => match (props) { when ({ loading }) { <Loading />; } when ({ error }) { <Error error={error} />; } when ({ data }) { <Page data={data} />; } }} </Fetch>
Tags
Annotators
URL
-
-
hackmd.io hackmd.io
Tags
Annotators
URL
-
-
docs.google.com docs.google.com
- Jan 2023
-
onlinelearning.berkeley.edu onlinelearning.berkeley.edu
-
WHERE HORSE.OWNER_ID = OWNER.OWNER_ID;
Where clauses can be used to specify join matching logic. A where clause can be used to indicate that a column in table A is equal to a column in table B, and that equivilancy can be used to join table A rows to table B rows. THe format is as simple as
TableA.MatchingColumn = TableB.MatchingColumn
-
- Dec 2022
-
Tags
Annotators
URL
-
-
peps.python.org peps.python.org
Tags
Annotators
URL
-
-
peps.python.org peps.python.org
Tags
Annotators
URL
-
- Sep 2022
-
developer.mozilla.org developer.mozilla.org
- Jul 2022
-
bafybeibbaxootewsjtggkv7vpuu5yluatzsk6l7x5yzmko6rivxzh6qna4.ipfs.dweb.link bafybeibbaxootewsjtggkv7vpuu5yluatzsk6l7x5yzmko6rivxzh6qna4.ipfs.dweb.link
-
boredom, as it does not fully engage the attention, while a too difficult one produces anxiety, as theperson becomes afraid to fail. Only a task that is challenging enough will engender the level ofintense, but tranquil, concentration that characterizes flow. There are two ways to control thebalance between challenges and skills: changing the intrinsic difficulty of the task, and changing theperson’s ability to cope with the task. At first sight, balance could be achieved by proposing arelatively easy task at which the person is not particularly skilled. But a more advanced model seesflow as emerging from high skills applied to difficult challenges (Fig. 1). In this more complexmodel (Nakamura & Csikszentmihalyi, 2002), limited skills applied to limited challenges merelyproduce apathy, as there is not much to create interest.This means that a good mobilization system not only should present goals that are difficultto reach, but provide the additional abilities necessary to handle that difficulty. This is the “newskills” feature that characterizes a truly compelling technology: you will feel most stimulated to usea tool if it allows you to tackle challenges that you could not tackle without it—albeit in such a waythat its use is fully intuitive and transparent. Eventually, a good tool should start to feel like anaugmentation or extension of yourself—the way a stick extends the reach of your arm, a telescopeextends your vision, and a notebook extends your memory.
Balance between difficulty of task and level of skills Task that is too easy produces boredom, too difficult produces anxiety. Flow state exists when the difficulty is balanced with the skill level.
New technologies and processes are new tools that are exciting to learn because they allow us to engage old problems in novel new ways. When we innovate and solve problems using novel techniques, it increases our level of engagement and satisfaction.
-
- May 2022
-
tc39.es tc39.es
Tags
Annotators
URL
-
- Mar 2022
-
Tags
Annotators
URL
-
-
wicg.github.io wicg.github.io
-
The URLPattern API provides a web platform primitive for matching URLs based on a convenient pattern syntax.
Tags
Annotators
URL
-
- Aug 2021
-
-
Carragher, D., Towler, A., Mileva, V. R., White, D., & Hancock, P. J. (2021). Masked face identification is improved by diagnostic feature training. PsyArXiv. https://doi.org/10.31234/osf.io/e9fq3
-
-
-
# And standalone like a case:Qo.match(people.first, Qo.m(age: 10..19) { |person| "#{person.name} is a teen that's #{person.age} years old" }, Qo.m(:*) { |person| "#{person.name} is #{person.age} years old" })
-
# How about some "right-hand assignment" pattern matchingname_longer_than_three = -> person { person.name.size > 3 }people_with_truncated_names = people.map(&Qo.match_fn( Qo.m(name_longer_than_three) { |person| Person.new(person.name[0..2], person.age) }, Qo.m(:*) # Identity function, catch-all))
-
- Jul 2021
-
github.com github.com
Tags
Annotators
URL
-
-
www.toptal.com www.toptal.com
-
In the examples above, the number 42 on the left hand side isn’t a variable that is being assigned. It is a value to check that the same element in that particular index matches that of the right hand side.
-
- Jun 2020
-
psyarxiv.com psyarxiv.com
-
Carragher, D., & Hancock, P. J. (2020). Surgical face masks impair human face matching performance for familiar and unfamiliar faces. https://doi.org/10.31234/osf.io/n9mt5
-
-
link.springer.com link.springer.com
-
Li, Z., Phillips, J., & Durgin, F. H. (2011). The underestimation of egocentric distance: Evidence from frontal matching tasks. Attention, Perception, & Psychophysics, 73(7), 2205. https://doi.org/10.3758/s13414-011-0170-2
-
- Jan 2020
-
academic.oup.com academic.oup.com
-
Losing face
Open research working paper version: https://eprints.soton.ac.uk/427678/1/LosingFace_workingversion_nomarpar.pdf
-
- Mar 2019
-
www.washingtonpost.com www.washingtonpost.com
-
Roth, now 67, gravitated to matching markets, where parties must choose one another, through applications, courtship and other means. In 1995, he wrote a mathematical algorithm that greatly improved the efficiency of the system for matching medical school graduates to hospitals for their residencies. That work led him to improve the matching models for law clerkships, the hiring of newly minted economists, Internet auctions and sororities. “I’m a market designer,” he says. “Currently, I’m focused on kidneys. We’re trying to match more donor kidneys to people globally.”
Interesting for many, many fields.
-