Private instance accessors (getters and setters)
- Jun 2021
 - 
            
babeljs.io babeljs.io
- 
  
 - 
  
class Person { #firstname = "Babel"; #lastname = "JS"; get #name() { return this.#firstname + " " + this.#lastname; } sayHi() { alert(`Hi, ${this.#name}!`); } }
 - 
  
we now support let x: typeof import('./x');, added in TypeScript 2.9
 - 
  
Babel implements multiple variants of this proposal to help TC39 test and gather feedback from the community. As with all proposals, expect changes in the future.
 
 - 
  
 - 
            
disqus.com disqus.com
- 
  
The answer is no, we use a pattern where we do this, and have a `static` method for manufacturing the constructor.e.g.static from({prop1, prop2}) => new this(public prop1, public prop2)
 - 
  
I like auto-property generation... who needs boilerplate code?
 
 - 
  
 - 
            
- 
  
TypeScript includes a concise way to create and assign a class instance property from a constructor parameter.
 
 - 
  
 - 
            
betterprogramming.pub betterprogramming.pub
- 
  
Then, people from programming communities (mainly front-end) realized that CoffeeScript is out of date and is starting to lag behind the ever-evolving Javascript environment. As of today, January 2020, CoffeeScript is completely dead on the market (though the GitHub repository is still kind of alive).
 - 
  
 - 
  
It was the first to present the concept of creating a function without a superfluous keyword function, replacing it with something that in 2015 was to become the function arrow (=> in ES6, -> in CoffeeScript). He also got rid of the curly braces (like Python), replacing them with indentations. Often in CoffeeScript, you can omit (once required) parentheses, that often unnecessarily decrement the readability of the code.
 
 - 
  
 - 
            
www.hebergementwebs.com www.hebergementwebs.com
 - 
            
basarat.gitbook.io basarat.gitbook.ioClasses1
- 
  
If an access modifier is not specified it is implicitly public as that matches the convenient nature of JavaScript 🌹.
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
I don't think this warrants adding to the Array class, since it's not generalizable to all the types that Arrays can contain.
You could say the same thing about
Array#sort. It can cause an error if elements of the array aren't all of the same type/shape. Just make sure it's safe to use first, and thenArray#sort,Array#sum,Array#average, ... are all quite handy and useful to have on Array class. - 
  
That's not exactly Symbol#to_proc conversion — it's part of the inject interface, mentioned in the documentation. The to_proc operator is &
 - 
  
instance_eval { reduce(:+) / size.to_f }
 - 
  
Programmers should be encouraged to understand what is correct, why it is correct, and then propagate.
new tag?:
- understand why it is correct
 
 - 
  
I don't think it is too clever. I think it solves the problem idiomatically. I.e., it uses reduce, which is exactly correct. Programmers should be encouraged to understand what is correct, why it is correct, and then propagate. For a trivial operation like average, true, one doesn't need to be "clever". But by understanding what "reduce" is for a trivial case, one can then start applying it to much more complex problems. upvote.
 - 
  
Thanks, this was just what I was looking for! This is a perfect appropriate use of instance_eval. I do not understand the nay-sayers. If you already have your array in a variable, then sure, a.reduce(:+) / a.size.to_f is pretty reasonable. But if you want to "in line" find the mean of an array literal or an array that is returned from a function/expression — without duplicating the entire expression ([0,4,8].reduce(:+) / [0,4,8].length.to_f, for example, is abhorrent) or being required to assign to a local, then instance_eval option is a beautiful, elegant, idiomatic solution!!
 - 
  
instance_eval is analogous to using tap, yield_self, … when you are dealing with a chain of method calls: do use it whenever it's appropriate and helpful! And in this case, I absolutely believe that it is.
 - 
  
instance_eval lets you run the code while only specifying a once, so it can be chained with other commands. I.e. random_average = Array.new(10) { rand(10) }.instance_eval { reduce(:+) / size.to_f } instead of random = Array.new(10) { rand(10) }; random_average = random.reduce(:+) / random.size
 - 
  
I don't know, using instance_eval this way just seems weird, and it has a lot of gotchas associated with it that make this approach a bad idea, IMO. (For example, if you tried to access and instance variable or a method on self inside that block, you'd run into problems.) instance_eval is more for metaprogramming or DSL.
But that's exactly when/why you'd use it: to make
selfrefer to the instance! Just learn that and you'll be fine. You can still access locals from outside the block. And if you need to access instance variables/methods of a different instance, then sure, it's probably a sign you shouldn't be using instance_eval here. - 
  
I agree, don't use this in your application code.
 - 
  
Or if you're looking for a core extension that adds this to the Array class, I'd recommend the facets gem (require 'facets/array/average'). Then you can just do array.average. And, from looking at the source, it turns out they do the exact same thing as the instance_eval approach above. The only difference is that it's implemented as a method—which of course already has self pointing to itself—instead of a block): def average; return nil if empty?; reduce(:+) / length.to_f; end Main advantage of this is that it's even more concise/readable and it handles the empty? case.
 
Tags
- concise
 - too clever
 - I have a differing opinion
 - having a deep understanding of something
 - clever
 - reduce
 - Ruby
 - Ruby: instance_eval
 - Ruby: to_proc
 - combating widespread incorrectness/misconception by consistently doing it correctly
 - quotable
 - where it shines / best application
 - annotation meta: may need new tag
 - easy to falsely assume
 - distinction
 - not:
 - generalizable
 - programming languages: learning/understanding the subtleties
 - ruby: arrays
 - example of: reduce
 - ruby library
 - programming: understand the language, don't fear it
 - recommended software
 - appropriateness
 - idiomatic Ruby
 - good advice
 - I disagree
 - appropriate use case
 - recommended library
 - spreading/propagating good ideas
 - one-liners
 - I agree
 - gem: facets
 - my comments
 - analogy
 - clever solution
 - idiomatic (programming)
 
Annotators
URL
 - 
  
 - 
            
steamcommunity.com steamcommunity.com
- 
  
Wooow! Have you passed this level with or without tools?
Are they expecting the post author has written/found a tool to programmatically find the optimal solution?? That is something I would think to do but seems so unlikely to expect a general player to do that, or to think that such a tool even exists.
 
 - 
  
 - 
            
store.steampowered.com store.steampowered.com
- 
  
graphics are not really important in the grand scheme of things, even less so in puzzlers, but the diorama-like presentation of forests and cute animals immediately won me over, and I found small things like moving animals in the backround hours into the game. gotta admire the attention to detail.
 - 
  
add some quality of life stuff like volume sliders, windowed mode, unlimited undo, etc.
 - 
  
when it first came out, cubicity: slide puzzle was full of mobile shenanigans, but based on feedback the developers quickly 'de-mobilized' it during launch week
 
 - 
  
 - 
            
dba.stackexchange.com dba.stackexchange.com
- 
  
all are basically standard SQL, but no RDBMS supports the standard completely.
 - 
  
I suggest to make it UNIQUE because it seems like the column should be unique
 
 - 
  
 - 
            
www.postgresql.org www.postgresql.orgSELECT1
- 
  
A LATERAL item can appear at top level in the FROM list, or within a JOIN tree. In the latter case it can also refer to any items that are on the left-hand side of a JOIN that it is on the right-hand side of.
 
 - 
  
 - 
            
wiki.postgresql.org wiki.postgresql.org
- 
  
SELECT base.nr, multiples.multiple FROM (SELECT generate_series(1,10) AS nr) base, LATERAL ( SELECT multiples.multiple FROM ( SELECT generate_series(1,10) AS b_nr, base.nr * 2 AS multiple ) multiples WHERE multiples.b_nr = base.nr ) multiples;
 
 - 
  
 - 
            
dba.stackexchange.com dba.stackexchange.com
- 
  
SELECT s.id, s1.percent_water , s1.percent_water * 100 AS percent_water_100 FROM samples s , LATERAL (SELECT s.wet_weight / NULLIF(s.dry_weight - 1, 0) AS percent_water) s1;
 - 
  
I added NULLIF() to defend against division-by-zero errors.
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
This answer is pretty old but today SPA works most of the time on static server-less env, so doing this with Javascript is more than legit.
 
 - 
  
 - 
            
iso639-3.sil.org iso639-3.sil.org
 - 
            
en.wikipedia.org en.wikipedia.org
- 
  
ISO 639-3 extends the ISO 639-2 alpha-3 codes with an aim to cover all known natural languages.
 - 
  
 
 - 
  
 - 
            
en.wikipedia.org en.wikipedia.org
- 
  
The terms autonym and xenonym also had different applications,[3] thus leaving endonym and exonym as the preferred forms.
 - 
  
nativeNamein https://gist.github.com/piraveen/fafd0d984b2236e809d03a0e306c8a4d is the endonym for the language. 
 - 
  
 - 
            
en.wikipedia.org en.wikipedia.org
 - 
            
en.wikipedia.org en.wikipedia.org
Tags
Annotators
URL
 - 
  
 - 
            
japanese.stackexchange.com japanese.stackexchange.com
- 
  
語 is the suffix which means 'language'. Unlike English which needs two different nouns for a country and its language, in Japanese, you can simply add 語 after the name of a country to mean the language spoken in that country. (e.g. ドイツ = Germany, ドイツ語 = German, フランス = France, フランス語 = French)
 
 - 
  
 - 
            
en.wiktionary.org en.wiktionary.org
- 
  
(This term, にほんご, is an alternative spelling of the above term.)
 
 - 
  
 - 
            
www.groovy-lang.org www.groovy-lang.org
 - 
  
 - 
            
loc.gov loc.gov
- 
  
This doesn't seem entirely trust-worthy/useful.
The native name seems incorrect/missing for some languages, like German, Hebrew, compared to https://gist.github.com/piraveen/fafd0d984b2236e809d03a0e306c8a4d
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
The US Library of Congress has been designated the official registration authority by the ISO and they publish the entire, official, up-to-date list as a trivial to parse text file for free.
 
 - 
  
 - 
            
gist.github.com gist.github.com
 - 
            
gist.github.com gist.github.com
 - 
            
en.wikipedia.org en.wikipedia.org
- 
  
Through a linkpin called "Property Value Alias", Unicode has made a 1:1 connection between a script defined, and its ISO 15924 standard.
 - 
  
The following standards are referred to as indispensable by ISO 15924.
 - 
  
 
 - 
  
 - 
            
www.w3.org www.w3.org
- 
  
Critical to the acceptance of the position of the script subtag was the inclusion of information in the registry to make clear the need to avoid script subtags except where they add useful distinguishing information. Thus, the registry entry for the language subtag "en" (English) has a field called "Suppress-Script" indicating that the script subtag "Latn" should be avoided with that language, since virtually all English documents use the Latin script.
- not worth saying
 - not necessary to say/write
 - useless information
 
Suppress-Script
 - 
  
Another problem was the ambiguity of RFC 3066 regarding the generative syntax. The idea of "language-dash-region" language tags was easy enough to grasp; most users didn't read RFC 3066 directly or consider the unstated-but-realized implication that other subtags might sometimes occur in the second position.
unstated-but-realized
 - 
  
Language Range ... matches ... does not match de de, de-CH, de-AT, de-DE, de-1901, de-AT-1901 en, fr-CH
 - 
  
Because ISO code lists were not always free and because they change over time, a key idea was to create a permanent, stable registry for all of the subtags valid in a language tag.
Why was it not free???
 - 
  
excepting a few grandfathered registrations, all tags are now generative
 - 
  
grandfathered = tags listed in the old registry that are not otherwise redundant (a closed list)
 - 
  
This article is only of historical interest, since the proposed new approach it refers to was published as RFC 4646 and RFC 4647 (collectively known as BCP 47) in September 2006, and have since been revised. The article is now out of date.
 - 
  
BCP stands for Best Current Practice
 
 - 
  
 - 
            
social.msdn.microsoft.com social.msdn.microsoft.com
- 
  
I'm not sure why MSFT decided to change these codes in the first place. While it might have been a noble goal to follow the IETF standard (though I'm not really familiar with this), the old codes were already out there, and most developers don't benefit by the new codes, nor care about what these codes are called (a code is a code). Just the opposite occurs in fact, since now everyone including MSFT itself has to deal with two codes that represent the same language (and the resulting problems). My own program needs to be fixed to handle this (after a customer contacted me with an issue), others have cited problems on the web (and far more probably haven't publicised theirs), and MSFT itself had to deal with this in their own code. This includes adding both codes to .NET even though they're actually the same language (in 4.0 they distinguished between the two by adding the name "legacy" to the full language name of the older codes), adding special documentation to highlight this situation in MSDN, making "zh-Hans" the parent culture of "zh-CHS" (not sure if it was always this way but it's a highly questionable relationship), and even adding special automated code to newly created "add-in" projects in Visual Studio 2008 (only to later remove this code in Visual Studio 2010, without explanation and therefore causing confusion for developers - long story). In any case, this is not your doing of course, but I don't see how anyone benefits from this change in practice. Only those developers who really care about following the IETF standard would be impacted, and that number is likely very low. For all others, the new codes are just an expensive headache. Again, not blaming you of cours
 - 
  
I feel the pain. It is a normal thing that standards do evolve over time, though, and our software needs to cope with it.
 - 
  
I'm not sure why MSFT decided to change these codes in the first place. While it might have been a noble goal to follow the IETF standard (though I'm not really familiar with this), the old codes were already out there, and most developers don't benefit by the new codes, nor care about what these codes are called (a code is a code).
 
 - 
  
 - 
            
thoughtbot.com thoughtbot.com
 - 
            
pganalyze.com pganalyze.com
- 
  
HAVING avg(score) < 0.75 * (SELECT avg(score) FROM performance_reviews)
 - 
  
When you are dealing with an aggregate of aggregates, it needs to be accomplished in two steps. This can be done using a subquery as the FROM clause, essentially giving us a temporary table to then select from, allowing us to find the average of those averages.
 - 
  
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
Is there a way to select from multiple custom tables using ActiveRecord QueryMethods? I'm trying to replicate this SQL query using Ruby's ActiveRecord Query Methods. select employee.emplid, address.location from (....) employee, (....) address where employee.emplid = address.emplid
 - 
  
over (order by effdt desc) prev
select ... over
 
 - 
  
 - 
            
snippets.aktagon.com snippets.aktagon.com
- 
  
You can use jsonb_agg and jsonb_array_elements_text to flatten or unnest an array of arrays in PostgreSQL: SELECT jsonb_array_elements_text(jsonb_agg(array_of_arrays)) FROM x;
 
 - 
  
 - 
            
dba.stackexchange.com dba.stackexchange.com
- 
  
jsonb_pretty
 - 
  
That's going to be extremely ugly. Nothing about this makes sense. Your JSON schema should just have one object that has {"is_enabled":true}, or something like this {"name":"change","is_enable":true}.
 
 - 
  
 - 
            
snippets.aktagon.com snippets.aktagon.com
- 
  
ActiveRecord::Relation::QueryAttribute.new(nil, value, ActiveRecord::Type::Value.new)
bind variables
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
DISTINCT ON (1)
 - 
  
SELECT DISTINCT ON (1) t.id, t.name, d.last FROM tbl t LEFT JOIN LATERAL json_array_elements_text(data) WITH ORDINALITY d(last, rn) ON d.last <> t.name ORDER BY d.rn DESC;
 - 
  
There is a (hack-ish, i know, but) more reliable way to do the "cast" in 9.3: ('[' || d::text || ']')::json ->> 0
 - 
  
Unnest in a LEFT JOIN LATERAL (clean and standard-conforming)
 
 - 
  
 - 
            
www.postgresql.org www.postgresql.org
- 
  
unnest ( anyarray ) → setof anyelement Expands an array into a set of rows. The array's elements are read out in storage order.
 
 - 
  
 - 
            
www.dbrnd.com www.dbrnd.com
- 
  
This article is half-done without your Comment! *** Please share your thoughts via Comment ***
 
 - 
  
 - 
            
www.postgresql.org www.postgresql.org
 - 
            
www.compose.com www.compose.com
- 
  
And this has some immediate benefits: more efficiency, significantly faster to process, supports indexing (which can be a significant advantage, as we'll see later), simpler schema designs (replacing entity-attribute-value (EAV) tables with jsonb columns, which can be queried, indexed and joined, allowing for performance improvements up until 1000X!)
 - 
  
Besides efficiency, there are extra ways in which you can benefit from storing JSON in binary form. One such enhancement is the GIN (Generalized Inverted Index) indexes and a new brand of operators that come with them.
 - 
  
SELECT jsonb_array_elements_text(data->'genres') AS genre FROM books WHERE book_id = 1; That will expand the JSON array into a column:
 - 
  
This is an important one, as it will enable us to use the aggregate functions that we are familiar when dealing with relational databases, but in the otherwise counter-intuitive environment of JSON data.
 
 - 
  
 - 
            
www.javaer101.com www.javaer101.com
- 
  
As stated in the title, I am in a situation where I need to return a count of occurrences within an array, that is within a jsonb column.
 
 - 
  
 - 
            
- 
  
database: query builder
like ActiveRecord for node
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
jsonb_each_text
 - 
  
To find the problematic rows you can use a query like SELECT id FROM t WHERE jsonb_typeof(data_col) <> 'object';
jsonb_typeof
 - 
  
Your attempt should work. There is a mismatch in column name in your query though. The query uses col2 but the table is defined with col1.
I would actually lean towards making this a comment, at least the typo fix part. But if you remove the typo fix part, all that's left is "should work", which I guess should be a comment too since it's too short to be an answer.
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
select t.* from my_table t, jsonb_each(my_col) as value1(key1, value1), jsonb_each(value1) as value2(key2, value2) where jsonb_typeof(my_col) = 'object' and jsonb_typeof(value1) = 'object' and value2->>'Param3' = '6';
 - 
  
This means that you have a json structure different from that described in your question. You cannot use generic jsonb functions when the json structures differ in each row.
 
 - 
  
 - 
            
www.postgresql.org www.postgresql.org
- 
  
json_array_elements_text ( json ) → setof text jsonb_array_elements_text ( jsonb ) → setof text Expands the top-level JSON array into a set of text values. select * from json_array_elements_text('["foo", "bar"]') → value ----------- foo bar
 - 
  
Writing json_populate_record in the FROM clause is good practice, since all of the extracted columns are available for use without duplicate function calls.
 - 
  
The field/element/path extraction operators return NULL, rather than failing, if the JSON input does not have the right structure to match the request; for example if no such key or array element exists.
 - 
  
 
 - 
  
 - 
            
dba.stackexchange.com dba.stackexchange.com
- 
  
Use the -> operator instead of ->> in the reference to children. The way you have it, you'd first cast json / jsonb to text and then back to json.
 - 
  
The clean way to call a set-returning function is LEFT [OUTER] JOIN LATERAL. This includes rows without children. To exclude those, change to a [INNER] JOIN LATERAL
 - 
  
FROM test x1 LEFT JOIN test x2 ON x1.id = (x2.data->>'parent')::INT;
 
 - 
  
 - 
            
dba.stackexchange.com dba.stackexchange.com
 - 
            
dbfiddle.uk dbfiddle.uk
- 
  
linked to from https://dba.stackexchange.com/questions/83932/postgresql-joining-using-jsonb#83935 answer
 - 
  
a leap of faith?
 
 - 
  
 - 
            
vladmihalcea.com vladmihalcea.com
- 
  
The age_in_years is calculated for every record of the blog table. So, it works like a correlated subquery, but the subquery records are joined with the primary table and, for this reason, we can reference the columns produced by the subquery.
 
 - 
  
 - 
            
outdoors.stackexchange.com outdoors.stackexchange.com
- 
  
Mitch Hedberg - "I play the guitar. I taught myself how to play the guitar, which was a bad decision... because I didn't know how to play it, so I was a shitty teacher. I would never have went to me."
 - 
  
You can watch videos, but videos can't watch you.
 - 
  
No article or video can replace qualified instruction and experience
 - 
  
 
 - 
  
 - 
            
dba.stackexchange.com dba.stackexchange.com
- 
  
jsonb_array_elements('{"test": ["a1", ["b1", "b2"]]}'::jsonb->'test') as json
 - 
  
jsonb_typeof(json)
 - 
  
For a «zoom out» view of my current data, here is a table-free working test :
SQL: experimenting with table-free data
 
 - 
  
 - 
            
dba.stackexchange.com dba.stackexchange.com
- 
  
Careful, Instead of != you may need to IS DISTINCT FROM operator which also compares NULL value
 - 
  
INSERT INTO accounts (id, token, affiliate_code) VALUES (value1, value2, value3) ON CONFLICT (id) DO UPDATE SET token = value2,
 
 - 
  
 - 
            
- 
  
import { knex } from 'knex' // this is a function that you call to instantiate knex import { Knex } from 'knex' // this is a namespace, and a type of a knex object
 - 
  
TypeScript type exports changed significantly. While `import Knex from 'knex';` used to import the knex instantiation function, the namespace and the interface for the knex instantiation function/object, there is now a clear distinction between them:
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
You can use the pg_typeof() function, which also works well for arbitrary values. SELECT pg_typeof("stu_id"), pg_typeof(100)
pg_typeof
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
@7alhashmi: Yes, e.g. the 100 comes from the feature_values table
I guess @7alhashmi deleted their comment that this was in reply to??
 
 - 
  
 - 
            
docs.snowflake.com docs.snowflake.com
- 
  
SELECT * FROM departments AS d, LATERAL (SELECT * FROM employees AS e WHERE e.department_ID = d.department_ID)
 - 
  
In a FROM clause, the LATERAL keyword allows an inline view to reference columns from a table expression that precedes that inline view.
 
 - 
  
 - 
            
disqus.com disqus.com
- 
  
I'm happy to hear this is still useful 4 years later. The Internet is great!
 
Tags
Annotators
URL
 - 
  
 - 
            
ddrscott.github.io ddrscott.github.io
- 
  
Subqueries appearing in FROM can be preceded by the key word LATERAL. This allows them to reference columns provided by preceding FROM items. (Without LATERAL, each subquery is evaluated independently and so cannot cross-reference any other FROM item.) TL;DR - LATERAL allows subqueries to reference earlier tables.
 - 
  
SQL is all about nested subqueries. It's hard to escape without creating views, but who has time to lookup that syntax and get their DBA's permission to run the DDL?!?
 - 
  
SELECT * FROM ( -- build virtual table of all hours between -- a date range SELECT start_ts, start_ts + interval '1 hour' AS end_ts FROM generate_series( '2017-03-01'::date, '2017-03-03'::timestamp - interval '1 hour', interval '1 hour' ) AS t(start_ts) ) AS cal LEFT JOIN ( -- build virtual table of uptimes SELECT * FROM ( VALUES ('2017-03-01 01:15:00-06'::timestamp, '2017-03-01 02:15:00-06'::timestamp), ('2017-03-01 08:00:00-06', '2017-03-01 20:00:00-06'), ('2017-03-02 19:00:00-06', null) ) AS t(start_ts, end_ts) ) AS uptime ON cal.end_ts > uptime.start_ts AND cal.start_ts <= coalesce(uptime.end_ts, current_timestamp)
 - 
  
FROM generate_series('2017-03-01'::date, '2017-03-03'::timestamp - interval '1 hour', interval '1 hour' ) AS t(start_ts)
 
 - 
  
 - 
            
www.postgresql.org www.postgresql.org
- 
  
In this case it's probably better to have the function return a tabletype, RETURNS table, or define the output with OUT variables. Therecord defining syntax at time of query: SELECT foo() AS (a int, b text);
 - 
  
dlbink is a good example, since thestructure of the input query directly controls the stucture of thereturn type. The sever has no way to deal with that when the query isparsed and planned, so you have to help it out.
 
 - 
  
 - 
            
www.postgresql-archive.org www.postgresql-archive.org
- 
  
>> We have that already, it's named 'json_each_text' > Apparently you haven't looked at json parse/deparse costs ;P Well, a PL function is gonna be none too cheap either. Using something like JSON definitely has lots to recommend it --- eg, it probably won't break when you find out your initial spec for the transport format was too simplistic.
 
 - 
  
 - 
            
dba.stackexchange.com dba.stackexchange.com
- 
  
Also, In PostgreSQL, all tables already have a type created by the same name.
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
You can return the record directly from the UPDATE, which is much faster than calling an additional SELECT statement. Use RETURN QUERY and UPDATE with a RETURNING clause.
 - 
  
( user_id int , user_name varchar , last_activity timestamptz )
 - 
  
It might be a pain because every time you modify function's arguments you'll need to recreate/drop types aswell tho.
 - 
  
I personaly prefer the types approach. it assures that if the function is edited, all the queries will return correct results.
 
 - 
  
 - 
            
github.com github.com
- 
  
(Diagrams made with AsciiFlow)
 - 
  
Gary Foster has provided a script to migrate to Pundit.
 - 
  
Users who have installed it decided to trust me, and I'm not comfortable transferring that trust to someone else on their behalf. However, if you'd like to fork it, feel free.
Interesting decision... Seems like the project could have been handed off to new maintainers instead of just a dead-end abandoned project and little chance of anyone using it for new projects now.
Sure you can fork it, but without a clear indication of which of the many forks in the network graph to trust, I doubt few will take the (massively) extra time to evaluate all options and choose an existing fork as a "leader" (or create their own fork) to go with continuing maintenance...
 
 - 
  
 - 
            
github.com github.com
- 
  
This is LAAR. He's a horse my daughter drew.
 - 
  
This was inspired heavily by functionality in the CanCan gem
 - 
  
 - 
  
Please use it, fork it, make it more awesome.
 
 - 
  
 - 
            
github.com github.com
- 
  
this is kind of a blocker for me
 - 
  
it would significantly simplify the authentication in my application
 - 
  
but it only worked for me when placed above that conditional
Which conditional?
if (uses_credentials) {?By above you mean outside of?
Why would it need to be above (above) that? Unless you're setting
credentials: 'omit', that should condition be true.if (opts.credentials !== 'omit') { uses_credentials = true; } - 
  
sveltekit needs to actually set the cookie headers etc. if credentials is true
Broken link. Correct permalink: https://github.com/sveltejs/kit/blob/a59fbd07caa3fbee22b8c4abbf065be623c774d4/packages/kit/src/runtime/server/page.js#L133
In more recent version, it does set the cookie header: https://github.com/sveltejs/kit/blob/5f7fdbcfdc2ce02d613aa287778a50b064a872db/packages/kit/src/runtime/server/page/index.js#L122
 - 
  
I don't know how much workaround is it, but for now I'm using this approach:
Looks like a catch-all
api/[...route]internal endpoint that proxies to the real external API server. - 
  
This is a blocker for me as well, as I don't really understand how to interact with my backend while it's not implemented within sveltekit and uses cookie-based authentication.
 - 
  
This way I'm able to pass cookie back and forth, so this code kind of works:
 - 
  
'set-cookie': response.headers.get('set-cookie')
 - 
  
That said, third party cookies are subject to privacy concerns and are blocked by both browser extensions and even by some browsers themselves, so they shouldn't be relied upon.
 - 
  
If you do need to passthrough your mydomain.com cookies to a thirdparty.com domain, you can technically already do that now by implementing it as an endpoint and calling fetch('/my-endpoint')
 - 
  
I don't really want to re-implement all of my api endpoints to make this work. Is there a way to "mask" the thirdparty endpoints to pass through the cookies?
 - 
  
We need to be really careful about what's 'same origin' because the server has no idea what host/path the various cookies are associated with. It just has a list of cookies that the browser had determined to be relevant for this SSR'd page, and not for any other subrequests.
 
Tags
- +0.9
 - prefer simpler option
 - good point
 - pass-through cookies
 - cookies
 - I have this problem too
 - the specific context is important
 - pass-through arguments/props/options
 - third-party cookies
 - svelte-kit: external fetch: passing through cookies/credentials
 - ambiguous
 - cross-origin request
 - svelte-kit: requesting from external API
 - workaround
 - authentication: cookie-based
 - key source code
 - cookies: domain
 - I agree
 - deal-breaker
 - blocker/deal-breaker
 - svelte-kit: external fetch
 
Annotators
URL
 - 
  
 - 
            
www.dekudeals.com www.dekudeals.com
- 
  
Cape's Escape Game 2.5th Room
 
Tags
Annotators
URL
 - 
  
 - 
            
github.com github.com
- 
  
KV is used in 8 of the overlay locales at the moment (CS, DE, HI, JA, PL, PT, SK, and CN). I don't agree with this and believe that Carmen should only reflect country codes that are part of the actual ISO standard.
 
Tags
Annotators
URL
 - 
  
 - 
            
en.wikipedia.org en.wikipedia.org
- 
  
As of 4 September 2020[update], 98 out of 193 (51%) United Nations (UN) member states, 22 out of 27 (81%) European Union (EU) member states, 26 out of 30 (87%) NATO member states, and 31 out of 57 (54%) Organisation of Islamic Cooperation (OIC) member states have recognised Kosovo. The government of Serbia does not recognise it as a sovereign state.
 
 - 
  
 - 
            
en.wikipedia.org en.wikipedia.org
- 
  
is a part of the United Kingdom that is variously described as a country, province, territory or region
 
 - 
  
 - 
            
en.wikipedia.org en.wikipedia.org
- 
  
Similarities in dialects[edit]
 
 - 
  
 - 
            
en.wikipedia.org en.wikipedia.org
- 
  
The lexicon (or, roughly, the base or essential vocabulary – such as "say" but not "said, tell, told")
 
Tags
Annotators
URL
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
 - 
            
stackoverflow.com stackoverflow.com
- 
  
scope :with_spec_options, ->(spec_options) { where("specs->'spec_option' @> ?", spec_options.to_json) }
 - 
  
where("specs->'spec_option' ?| array[:options]", options: spec_options)
 
 - 
  
 - 
            
www.postgresql.org www.postgresql.org
- 
  
-- The array on the right side is not considered contained within the -- array on the left, even though a similar array is nested within it: SELECT '[1, 2, [1, 3]]'::jsonb @> '[1, 3]'::jsonb; -- yields false -- But with a layer of nesting, it is contained: SELECT '[1, 2, [1, 3]]'::jsonb @> '[[1, 3]]'::jsonb;
 
 - 
  
 - 
            
github.com github.com
- 
  
%w{ JsonDashArrow JsonDashDoubleArrow JsonHashArrow JsonHashDoubleArrow JsonbAtArrow JsonbArrowAt JsonbQuestion JsonbQuestionAnd JsonbQuestionOr CastJson }.each do |name| const_set name, Class.new(Binary) end
 
 - 
  
 - 
            
stackoverflow.com stackoverflow.com
- 
  
 - 
  
Rarely does one encounter a question that is interesting, challenging and extremely well-presented. Good job!
 - 
  
And, if you think about it, only the pointy ones are used un-paired in regex construct's. All the other pairs are balanced. I'd steer clear of that pair <>
 - 
  
As far as "Is there really no way to escape the < here?" there is a way... but you're not going to like it: %r<(?#{'<'}!foo)> == %r((?<!foo))
 
 - 
  
 - 
            
docs.digitalocean.com docs.digitalocean.com
- 
  
On RHEL-based operating systems (like CentOS and Fedora), use yum
 - 
  
On Debian-based operating systems (like Ubuntu), use apt-get
 - 
  
curl -sSL https://repos.insights.digitalocean.com/install.sh -o /tmp/install.sh
 
 - 
  
 - 
            
developer.mozilla.org developer.mozilla.org
- 
  
A cookie is associated with a domain. If this domain is the same as the domain of the page you are on, the cookie is called a first-party cookie. If the domain is different, it is a third-party cookie. While the server hosting a web page sets first-party cookies, the page may contain images or other components stored on servers in other domains (for example, ad banners), which may set third-party cookies. These are mainly used for advertising and tracking across the web.
 
 - 
  
 - 
            
developer.mozilla.org developer.mozilla.orgProxy2
- 
  
get: function(target, prop, receiver) { return "world"; }
 - 
  
With the help of the Reflect class we can give some accessors the original behavior and redefine others:
 
 - 
  
 - 
            
developer.mozilla.org developer.mozilla.org
- 
  
The globalThis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. Unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. In this way, you can access the global object in a consistent manner without having to know which environment the code is being run in.
 
 - 
  
 - 
            
github.com github.com
- 
  
Unlike browsers, you can access raw Set-Cookie headers manually using Headers.raw(). This is a node-fetch only API.
 
 - 
  
 - 
            
github.com github.com
- 
  
(load functions call handle directly, there's no intermediate network requests.)
 - 
  
shouldn't be a just URL it should be for recourceId
He keeps talking about a "resource id" -- which id would this be?
 - 
  
Thanks, @Kapsonfire-DE for better understanding the original issue.
 - 
  
Worth noting that in the case where you're proxying /api/ requests to an external server in nginx you can easily do this in handle today:
 
 - 
  
 - 
            
developer.mozilla.org developer.mozilla.org
 - 
            
developers.google.com developers.google.com
 - 
            
kit.svelte.dev kit.svelte.dev
- 
  
If you return a Promise from load, SvelteKit will delay rendering until the promise resolves.
 - 
  
should not reference any API keys or secrets, which will be exposed to the client
How would they be exposed? Because
load()lives in Svelte component files (__layout.svelte), whose code is made available both to server and client environments. - 
  
should run on the same domain as any upstream API servers requiring credentials
 - 
  
When fetch runs on the server, the resulting response will be serialized and inlined into the rendered HTML. This allows the subsequent client-side load to access identical data immediately without an additional network request.
 
 - 
  
 - 
            
www.apollographql.com www.apollographql.com
- 
  
graphqlSync is a relatively recent addition to GraphQL.js that lets you execute a query that you know is going to return synchronously and get the result right away, rather than getting a promise. Since we know that introspection won’t require calling any asynchronous resources, we can safely use it here.
 - 
  
 
 - 
  
 - 
            
www.apollographql.com www.apollographql.com
 - 
            
docs.gitlab.com docs.gitlab.com
- 
  
 - 
  
o help us meet this vision, the frontend should use GraphQL in preference to the REST API for new features.
 - 
  
We want the GraphQL API to be the primary means of interacting programmatically with GitLab. To achieve this, it needs full coverage - anything possible in the REST API should also be possible in the GraphQL API.
 
 - 
  
 - 
            
 - 
            
github.com github.com
- 
  
 - 
  
IDE
 
Tags
Annotators
URL
 - 
  
 - 
            
- 
  
How does this work/help?
 
 - 
  
 - 
            
- 
  
would be different depending on whether the fetch is internal or external
 - 
  
A litmus test on whether an option belongs to adapter config or kit config, would be to ask whether the option becomes irrelevant when you switch the adapter to static.
 
 -