- Sep 2024
-
-
There is the handy rails server -d that starts a development Rails as a daemon. The annoying thing is that the scheduler as seen above is started in the main process that then gets forked and daemonized. The rufus-scheduler thread (and any other thread) gets lost, no scheduling happens.
-
-
stackoverflow.com stackoverflow.com
-
But fork does not copy the parent process's threads. Thus locks (in memory) that in the parent process were held by other threads are stuck in the child without owning threads to unlock them, ready to cause a deadlock when code tries to acquire any of them. Also any native library with forked threads will be in a broken state.
-
-
pythonspeed.com pythonspeed.com
-
In particular, one thing that fork() doesn’t copy is threads. Any threads running in the parent process do not exist in the child process.
-
-
www.omsmeasure.com www.omsmeasure.com
-
“Accuracy” indicates the closeness of a measurement to the true value but it cannot be quantified because it is not possible to know the true value.
-
-
www.gertgoet.com www.gertgoet.com
-
# booleans # simple: providing any value for ENV['FORCE_SSL'] means `true`: force_ssl = !!ENV['FORCE_SSL'] # more advanced: # only when we provide 'true' will `force_ssl` become true. force_ssl = ('true' == ENV['FORCE_SSL'])
-
- May 2024
-
www.rfc-editor.org www.rfc-editor.org
-
Please note that '+' characters are frequently used as part of an email address to indicate a subaddress, as for example in <bill+ietf@example.org>.
Nice of them to point that this is a common scenario, not just a hypothetical one.
Tags
Annotators
URL
-
-
github.com github.com
-
To point out subtle caveats, corner cases and pitfalls that may cause an advanced user's otherwise working script to fail under future circumstances.
-
-
- Apr 2024
-
kb.mozillazine.org kb.mozillazine.org
-
Do NOT try to delete the All Mail folder by deleting its contents. That will delete all of the messages for the account when Thunderbird syncs the folder.
-
-
superuser.com superuser.com
-
From here, you can configure the FIRST SYNCHRONIZATION OPTION (Important! If you mess with the lower options you might delete copies on the mail server).
-
- Mar 2024
-
stackoverflow.com stackoverflow.com
-
The reason it works when using one statement is that local swallows the return type of the right hand side (e.g. local foo=$(false) actually returns the zero status code); that's one of bash's many pitfalls.
-
- Feb 2024
-
unix.stackexchange.com unix.stackexchange.com
-
The input format of the xargs command doesn't match what any other command produces. Yes, it's bizarre. With -I, xargs ignores indentation, which is why the file names with initial spaces are mangled. Do not use xargs except with the -0 option or when you know your input doesn't contain characters that would confuse it.
-
-
stackoverflow.com stackoverflow.com
-
DO NOT PARSE LS.
-
Do not use xargs without -d when you do not want ' " \ to be handled specially.
-
- Jan 2024
-
gitlab.com gitlab.com
-
I thing you are doing a very subtle mistake which will become fatal in long-term. Your strategy to take small steps that cover as much functionality as possible is reasonable, but it is necessary to be careful, as it leads to a critical state when there is too much little stuff built up without proper structure to support it.
-
- Dec 2023
-
developers.google.com developers.google.com
-
Cross-Account Protection does not currently send security events for Google Workspace (formerly G Suite) users.
That's a pretty major caveat
Tags
Annotators
URL
-
- Sep 2023
-
stackoverflow.com stackoverflow.com
-
the OP's problem can not be solved simply by changing $IFS, because $IFS doesn't apply to quoted strings.
-
Bash doesn't do word expansion on quoted strings in this context. For example: $ for i in "a b c d"; do echo $i; done a b c d $ for i in a b c d; do echo $i; done a b c d
-
-
mywiki.wooledge.org mywiki.wooledge.org
-
Also, always prefix globs with "/" or "./"; otherwise, if there's a file with "-" as the first character, the expansions might be misinterpreted as options.
Tags
Annotators
URL
-
-
github.com github.com
-
Note that the mere presence of this header causes premailer to be skipped, i.e., even setting skip_premailer: false will cause premailer to be skipped. The reason for that is that the skip_premailer is a simple header and the value is transformed into a string, causing 'false' to become truthy.
They should fix this!
lib/premailer/rails/hook.rb
def skip_premailer_header_present? message.header[:skip_premailer] end
-
- Jul 2023
-
stackoverflow.com stackoverflow.com
-
As this answer warns placing the include at the top level pollutes the Object namespace. Instead, I should have written
-
- May 2023
-
www.reddit.com www.reddit.com
-
I'm not actually setting a productivity goal, I'm just tracking metadata because it's related to my research. Of which the ZettelKasten is one subject.That being said, in your other post you point to "Quality over Quantity" what, in your opinion, is a quality note?Size? Number of Links? Subjective "goodness"?
reply to u/jordynfly at https://www.reddit.com/r/Zettelkasten/comments/13b0b5c/comment/jjcu3cn/?utm_source=reddit&utm_medium=web2x&context=3
I'm curious what your area of research is? What are you studying with respect to Zettelkasten?
Caveat notetarius. Note collections are highly idiosyncratic to the user or intended audience, thus quality will vary dramatically on the creator's needs and future desires and potential uses. Contemporaneous, very simple notes can be valuable for their initial sensemaking and quite often in actual practice stop there.
Ultimately, only the user can determine perceived quality and long term value for themselves. Future generations of historians, anthropologists, scholars, and readers, might also find value in notes and note collections, but it seems rare that the initial creators have written them with future readers and audiences in mind. Often they're less useful as the external reader is missing large swaths of context.
For my own personal notes, I consider high quality notes to be well-sourced, highly reusable, easily findable, and reasonably tagged/linked. My favorite, highest quality notes are those that are new ideas which stem from the combination of two high quality notes. With respect to subjectivity, some of my philosophy is summarized by one of my favorite meta-zettels (alt text also available) from zettelmeister Umberto Eco.
Anecdotally, 95% of my notes are done digitally and in public, but I've only got scant personal evidence that anyone is reading or interacting with them. I never write them with any perceived public consumption in mind (beyond the readers of the finished pieces that ultimately make use of them), but it is often very useful to get comments and reactions to them. I'm only aware of a small handful of people publishing their otherwise personal note collections (usually subsets) to the web (outside of social media presences which generally have a different function and intent).
Intellectual historians have looked at and documented external use cases of shared note collections, commonplace books, annotated volumes, and even diaries. There are even examples of published (usually posthumously) commonplace books, waste books, etc., but these are often for influential public and intellectual figures. Here Ludwig Wittgenstein's Zettel, Walter Benjamin's Arcades Project, Vladimir Nabokov's The Original of Laura, Roland Barthes' Mourning Diary, Georg Christoph Lichtenberg's Waste Books, Ralph Waldo Emmerson, Ronald Reagan's card index commonplace, Stobaeus' Anthology, W. H. Auden's A Certain World, and Robert Southey’s Common-Place Book come quickly to mind not to mention digitized scholarly collections of Niklas Luhmann, W. Ross Ashby, S.D. Goitein, Jonathan Edwards' Miscellanies, and Aby Warburg's notes. Some of these latter will give you an idea of what they may have thought quality notes to have been for them, but often they mean little if nothing to the unstudied reader because they lack broader context or indication of linkages.
-
- Dec 2022
-
documentation.mailgun.com documentation.mailgun.com
-
It is possible to use values defined via v: option or X-Mailgun-Variables in your templates. However if you do so, the variables are included in the delivered message via the X-Mailgun-Variables header. If this is not desired, use the t:variables option or X-Mailgun-Template-Variables header instead.
Why are they included in a header? Indeed that is not desired. So why not just not do that? Why is it different if you use
t:variables
? Why the inconsistency?
-
-
github.com github.com
-
Note: it is not possible to apply a boolean scope with just the query param being present, e.g. ?active, that's not considered a "true" value (the param value will be nil), and thus the scope will be called with false as argument. In order for the scope to receive a true argument the param value must be set to one of the "true" values above, e.g. ?active=true or ?active=1.
Is this behavior/limitation part of the web standard or a Rails-specific thing?
-
- Nov 2022
-
documentation.mailgun.com documentation.mailgun.com
-
In our system, events are generated by physical hosts and follow different routes to the event storage. Therefore, the order in which they appear in the storage and become retrievable - via the events API - does not always correspond to the order in which they occur. Consequently, this system behavior makes straight forward implementation of event polling miss some events. The page of most recent events returned by the events API may not contain all the events that occurred at that time because some of them could still be on their way to the storage engine. When the events arrive and are eventually indexed, they are inserted into the already retrieved pages which could result in the event being missed if the pages are accessed too early (i.e. before all events for the page are available). To ensure that all your events are retrieved and accounted for please implement polling the following way:
-
-
developer.mozilla.org developer.mozilla.org
-
Warning: This ignores the user's keyboard layout, so that if the user presses the key at the "Y" position in a QWERTY keyboard layout (near the middle of the row above the home row), this will always return "KeyY", even if the user has a QWERTZ keyboard (which would mean the user expects a "Z" and all the other properties would indicate a "Z") or a Dvorak keyboard layout (where the user would expect an "F"). If you want to display the correct keystrokes to the user, you can use Keyboard.getLayoutMap().
Wow, that's quite a caveat!
-
- Sep 2022
-
rubystyle.guide rubystyle.guide
-
Also be aware of how Ruby handles aliases and inheritance: an alias references the method that was resolved at the time the alias was defined; it is not dispatched dynamically.
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
Calling the same filter multiple times with different options will not work, since the last filter definition will overwrite the previous ones.
-
- Aug 2022
-
github.com github.com
-
I just learned today that extend apparently doesn't override class methods that are already defined, even though the extend happens later:
-
-
stackoverflow.com stackoverflow.com
-
There are many questions we can ask and answer about branch names. Each one is specific to one particular repository because all branch names are local to that particular repository. Any changes anyone makes in that repository affect only that one repository, at least at the time they make them.
which assumption? well, people make the assumption that our local repo should know some fact about the remote repo, like its default branch, without actually asking the remote about itself
-
-
askubuntu.com askubuntu.com
-
Bear in mind that lsof doesn't seem to present an easy solution because, once the device is disconnected, the associated names provided by lsof no longer include the name of the disconnected device.
-
- Jul 2022
-
stackoverflow.com stackoverflow.com
-
What ever you do, don't use a for loop: # Don't do this for file in $(find . -name "*.txt") do …code using "$file" done Three reasons: For the for loop to even start, the find must run to completion. If a file name has any whitespace (including space, tab or newline) in it, it will be treated as two separate names. Although now unlikely, you can overrun your command line buffer. Imagine if your command line buffer holds 32KB, and your for loop returns 40KB of text. That last 8KB will be dropped right off your for loop and you'll never know it.
-
-
stackoverflow.com stackoverflow.com
-
$0 can be set to an arbitrary value by the caller. On the flip side, $BASH_SOURCE can be empty, if no named file is involved; e.g.: echo 'echo "[$BASH_SOURCE]"' | bash
-
-
unix.stackexchange.com unix.stackexchange.com
-
If you don't use an intermediate variable, you need to protect the / characters in the directory to remove so that they aren't treated as the end of the search text.
-
If the path in question is at the beginning of the PATH variable, you need to match the colon at the end. This is an annoying caveat which complicates easy generic manipulations of PATH variables.
-
- Jun 2022
-
stackoverflow.com stackoverflow.com
-
these two SELECT clauses are NOT equivalent, so be careful: SELECT DISTINCT(event_id, start_time) FROM ... SELECT DISTINCT event_id, start_time FROM ...
-
- Apr 2022
-
stackoverflow.com stackoverflow.com
-
Caution: + continues the statement but not the string. puts "foo"+"bar".upcase gives you fooBAR, whereas puts ("foo"+"bar").upcase gives you FOOBAR. (Whether or not there's a newline after the +.) But: if you use a backslash instead of the plus sign, it will always give you FOOBAR, because combining lines into one statement, and then combining successive strings into one string, happen before the string method gets called.
-
- Mar 2022
-
unix.stackexchange.com unix.stackexchange.com
-
The last note is that when binding commands to keyboard shortcuts it is often necessary to only have one command, not two commands connected with a pipe like we use above. You can accomplish this by invoking your piped command as a command string argumetn to a new shell like this:
-
-
railsguides.net railsguides.net
-
The code will work without exception but it doesn’t set correct association, because the defined classes are under namespace AddStatusToUser. This is what happens in reality: role = AddStatusToUser::Role.create!(name: 'admin') AddStatusToUser::User.create!(nick: '@ka8725', role: role)
-
-
-
Active Record creates a transaction around each migration, and backfilling in the same transaction that alters a table keeps the table locked for the duration of the backfill. class AddSomeColumnToUsers < ActiveRecord::Migration[7.0] def change add_column :users, :some_column, :text User.update_all some_column: "default_value" end end
-
- Jan 2022
-
unix.stackexchange.com unix.stackexchange.com
-
tr '\n' '\\n' would change newlines to backslashes (and then there's an extra n in the second set). sed 's/\n/\\n/g won't work because sed doesn't load the line-terminating newline into the buffer, but handles it internally.
-
-
blog.atomist.com blog.atomist.com
-
The callback executed by setTimeout is not expected to return anything, it just ignores the returned value. Since once you enter the promise/async world in JavaScript you cannot escape, I was left to wonder what happens when the setTimeout callback returns a promise?
-
-
stackoverflow.com stackoverflow.com
-
test2 being marked async does wrap your return value in a new promise:
-
const rejectedP = Promise.reject('-'); const finallyP = rejectedP.finally(); const result1 = rejectedP; const result2 = new Promise(resolve => { const rejectedP = Promise.reject('-'); const finallyP = rejectedP.finally(); resolve(rejectedP); }); we can see that the first snippet creates two promises (result1 and rejectedP being the same) while the second snippet creates three promises. All of these promises are rejected, but the rejectedP rejection is handled by the callbacks attached to it, both through ….finally() and resolve(…) (which internally does ….then(resolve, reject)). finallyP is the promise whose rejection is not handled in the both examples. In the second example, result2 is a promise distinct from rejectedP that is also not handled, causing the second event.
-
-
stackoverflow.com stackoverflow.com
-
You basically did var a = promise.then(…); var b = promise.catch(…); creating a branch in the chain. If promise is getting rejected now, the catch callback will be called and b will be a fulfilled promise just fine, but the a promise is getting rejected too and nobody handles that. Instead, you should use both arguments of then and write Requirement.create({id: id, data: req.body.data, deleted: false}) .then(requirement => { res.json(requirement); }, reason => { let err = {'error': reason}; res.json(err); });
-
-
-
If at least one component has smallest unhandled error, the whole app will crash and users will not know what to do and developers will not know such an error occurred.
-
When an error is thrown inside a Promise it looks like Firefox still calls window.onerror, but Chrome swallows the error silently.
-
-
thecodebarbarian.com thecodebarbarian.com
-
Seems easy, right? How about the below code, what will it print? new Promise((_, reject) => reject(new Error('woops'))). catch(error => { console.log('caught', err.message); }); It'll print out an unhandled rejection warning. Notice that err is not defined!
-
-
datatracker.ietf.org datatracker.ietf.orgrfc72351
-
User agents are advised to take special care in parsing the field value, as it might contain more than one challenge, and each challenge can contain a comma-separated list of authentication parameters. Furthermore, the header field itself can occur multiple times.
Tags
Annotators
URL
-
-
zaiste.net zaiste.net
-
For given hash, OpenStruct constructor only converts its top level keys.require 'ostruct' h = { foo: { bar: 1 } } obj = OpenStruct.new(h) obj.foo # => { bar: 1} obj.foo.bar # => NoMethodError: undefined method `bar' for {:bar=>1}:Hash
-
-
www.typescriptlang.org www.typescriptlang.org
-
It’s important to understand that an implements clause is only a check that the class can be treated as the interface type. It doesn’t change the type of the class or its methods at all. A common source of error is to assume that an implements clause will change the class type - it doesn’t!
-
-
github.com github.com
-
// Without cloning this will point to the same object and they'll always be the same. // We'd basically change the object in the store without changing the store. let tmpCopyAsTemplates = deepClone($copyAsTemplates);
-
-
-
stackoverflow.com stackoverflow.com
-
Explicitly defining the dependency in the reactive declarations
-
inputValue = updateInputValue(value);
-
-
github.com github.com
-
github.com github.com
-
maybe this just comes down to general footguns with reactivity, and being aware of them as a developer.
-
-
support.mozilla.org support.mozilla.org
-
So if you subscribe to both Inbox and All mail you are in practise downloaded your mails twice. If you then delete a mail in inbox it doesnt go away in All mail. It just get the trash-tag. In my opinion you should never subscribe to All mail. You never need to see it. All you need to see are INBOX, TRASH, SENT and the folders YOU created in your gmail-account.
Tags
Annotators
URL
-
-
support.google.com support.google.com
-
If there is still a problem, try clearing Captcha again. I acknowledge you wrote that you already did this, but you must open that page using the account that you are setting up in Thunderbird. If you are signed into multiple Google accounts, the page will open with the primary account. To be certain that you have used the correct account, please try again after signing out.
This is a real usability issue.
That page (https://accounts.google.com/b/0/DisplayUnlockCaptcha) doesn't even tell you which account is active or give you any way to switch.
As a guess, I tried changing the number, like this: https://accounts.google.com/b/3/DisplayUnlockCaptcha to the same number as I saw in the URL for the account that I wanted to affect: https://mail.google.com/mail/u/3/#inbox and I think it worked (but again, no way to know for sure which account was affected).
-
-
kit.svelte.dev kit.svelte.dev
-
Code that is per-component instance should go into a second <script> tag.
But this seems to conflict with https://hyp.is/NO4vMmzVEeylBfOiPbtB2w/kit.svelte.dev/docs
The load function is reactive, and will re-run when its parameters change, but only if they are used in the function.
which seems to imply that load is not just run once for the component statically, but rather, since it can be reactive to:
url, params, fetch, session and stuff
may be sufficiently like a per-instance callback, that it could be used instead of onMount?
-
- Dec 2021
-
stackoverflow.com stackoverflow.com
-
For what it's worth, accessing attributes with [] is not the same as using send. The latter will call the accessor method, which is what you want 99/100.
-
- Nov 2021
-
stackoverflow.com stackoverflow.com
-
if you put the reactive statement $: validate(inputValue); after the function updateInputValue declaration, it's working as expected:
-
- Oct 2021
-
developer.mozilla.org developer.mozilla.org
-
const str = 'mañana mañana' const strReverse = str.split('').reverse().join('') // => "anãnam anañam" // notice how the first word has an ã rather ñ
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
On reload, MockedGateway is reloaded, but $PAYMENT_GATEWAY is not updated because initializers only run on boot. Therefore, it won't reflect the changes.
-
Please, do not mutate ActiveSupport::Dependencies.autoload_paths, the public interface to change autoload paths is config.autoload_paths.
-
-
www.orgroam.com www.orgroam.com
-
Org-roam capture templates are incompatible with org-capture templates.
-
Org-roam attempts to load both the org-ref and org-cite package when indexing files, so no further setup from the user is required for citation support.
-
You may assign multiple refs to a single node, for example when you want multiple papers in a series to share the same note, or an article has a citation key and a URL at the same time.
Tags
Annotators
URL
-
-
www.kylehq.com www.kylehq.com
-
And on any given day, developing with Svelte and its reactive nature is simply a dream to use. You can tell Svelte to track state changes on practically anything using the $: directive. And it’s quite likely that your first reactive changes will produce all the expected UI results. But as you start to rely more on UI updates based on variable or array/object changes, it’s likely that your UI will start skipping a beat and dropping values that you know explicitly to be there.
-
- Sep 2021
-
www.johnbridge.com www.johnbridge.com
-
The Code Expressly prohibits glueing dissimilar plastics together: Listed under "Prohibited Joints" "No glue joints between different tyes of plastic" REF: International Residential Code 2904.16.2 Uniform Plumbing Code 316.1.6 It is true that Oatey makes a glue that is listed as approved for both ABS & PVC however there still remains a good reason why it is not approved for glueing dissimilar types of plastics together. In a normal glueing situation the bonding material sticks to the surface of both pieces being fastened together, thus forming a bond, but such is not the case with plastic plumbing pipe and fittings. When connecting plastic plumbing fittings we must first use a solvent type cleaner/primer. While the cleaner primer does clean the fitting, its primary purpose is to soften or break the smooth glazed surface of the pipe which exposes the inner polimers. The glue then chemically softens the plastic on both the pipe wall and the fitting interior and the two surfaces then fuse together forming a chemical weld. The problem with attempting to glue dissimilar plastic is that they do not react to the glue at the same rate, therefore one material may soften and reharden again before the other surface has softened sufficiently to fuse a true weld. The end result is that while it has all the appearances of having glued together you are left with a weak joint, in the same manner as a cold solder joint.
Tags
Annotators
URL
-
- Aug 2021
-
stackoverflow.com stackoverflow.com
-
All answers here which mention scrollHeight/scrollWidth should be adjusted a bit to take body margins into account. Browsers apply default nonzero margins for documents' body element (and it's also applicable to content loaded into frames). The working solution I found is to add this: parseInt(window.getComputedStyle(this.contentDocument.body).margin.
-
-
-
Now consider we want to handle numbers in our known value set: const KNOWN_VALUES = Object.freeze(['a', 'b', 'c', 1, 2, 3]) function isKnownValue(input?: string | number) { return typeof(input) === 'string' && KNOWN_VALUES.includes(input) } Uh oh! This TypeScript compiles without errors, but it's not correct. Where as our original "naive" approach would have worked just fine. Why is that? Where is the breakdown here? It's because TypeScript's type system got in the way of the developer's initial intent. It caused us to change our code from what we intended to what it allowed. It was never the developer's intention to check that input was a string and a known value; the developer simply wanted to check whether input was a known value - but wasn't permitted to do so.
-
-
developer.mozilla.org developer.mozilla.orgwith1
-
If you forget to define x in the object you pass as the second argument, or if there's some similar bug or confusion, you won't get an error -- just unexpected results.
-
- Jul 2021
-
github.com github.com
-
That's because in CSS, any value at all -- even 'disabled="false"' or whatever -- is exactly the same as 'disabled' or 'disabled="disabled"'. The opposite of 'disabled="anything"' is to not have a disabled keyword in there at all.
Tags
Annotators
URL
-
-
blog.appsignal.com blog.appsignal.com
-
Putting comments like these can be helpful, but it’s still set up for doing something sketchy, especially if you are new to the codebase. Being new and not being aware of all the “gotchas” a code has can certainly send you down the concern downward spiral.
-
-
stackoverflow.com stackoverflow.com
-
was due to a form that was submitted (ALWAYS SET THAT TYPE-PROPERTY ON YOUR BUTTONS!) after my onclick-event fired, but before my request had any chance to be completed.
-
-
stackoverflow.com stackoverflow.com
-
A big gotcha needs to be mentioned: When testing transaction, you need to turn off transactional_fixtures. This is because the test framework (e.g Rspec) wraps the test case in transaction block. The after_commit is never called because nothing is really committed. Expecting rollback inside transaction doesn't work either even if you use :requires_new => true. Instead, transaction gets rolled back after the test runs.
-
-
github.com github.com
-
this happens with getClient and setClient because it is a svelte context which is only available at component initialization (construction) and cannot be in an event handler.
-
-
formidable.com formidable.com
-
This cache has a small trade-off! If we request a list of data, and the API returns an empty list, then the cache won't be able to see the __typename of said list and invalidate it.
That's one big caveat!
-
- Jun 2021
-
github.com github.com
-
but note that the value will be nil when using the attributes_for strategy.
-
-
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;
-
-
kit.svelte.dev kit.svelte.dev
-
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.
-
- May 2021
-
stackoverflow.com stackoverflow.com
-
this is incomplete. Yes you get a load of commits, but they no longer refer to the right paths. git log dir-B/somefile won't show anything except the one merge. See Greg Hewgill's answer references this important issue.
-
-
syslog.ravelin.com syslog.ravelin.com
-
The implicit dependencies between different versions of different services were not expressed anywhere, which led to various problems in building, continuous integration, and, notably, repeatable builds.
-
-
-
That image only contains 200 pixels horizontally, but the browser stretches it to 400px wide or even farther!Luckily, you’ll see there’s an easy “fix” there at the end: our old good friend the width attribute!<img src="example.gif", srcset="example.gif 200w" sizes="(min-width: 400px) 400px, 100vw" width="200" /* <=== TA-DA! */ class="logo">As long as you can specify the width attribute so it reflects the true maximum size of your largest image, you won’t run into this problem of having sizes make your image wider than it naturally should go.
-
The selected source size affects the intrinsic size of the image (the image’s display size if no CSS styling is applied).
-
- Apr 2021
-
stackoverflow.com stackoverflow.com
-
If anything it thwarts separation of concerns to a degree.
-
- Mar 2021
-
www.jackfranklin.co.uk www.jackfranklin.co.uk
-
Coming from React to Svelte this did catch me out numerous times but for me I now prefer Svelte's approach, particularly because it removes some of the boilerplate around useEffect.
-
-
api.rubyonrails.org api.rubyonrails.org
-
Note that autosave will only trigger for already-persisted association records if the records themselves have been changed. This is to protect against SystemStackError caused by circular association validations.
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
These methods should be used with caution, however, because important business rules and application logic may be kept in callbacks. Bypassing them without understanding the potential implications may lead to invalid data.
-
-
trailblazer.to trailblazer.to
-
Note that the :task option for step configures this element as a low-level circuit interface, or in other words, it will skip the wrapping with the task interface.
This bit me because I didn't realize that. Was getting error:
TypeError: no implicit conversion of Symbol into Integer
Finally checked
ctx
and found it was an array...At least this is documented here.
Tags
Annotators
URL
-
- Feb 2021
-
trailblazer.to trailblazer.to
-
Using Track() with a new track semantic only makes sense when using the [:magnetic_to option] on other tasks.
-
-
coderwall.com coderwall.com
-
Of course our object doesn't have any contacts yet, so our controller will need to make sure that the form has at least one fields_for block to render by giving it one on initialization
-
-
stackoverflow.com stackoverflow.com
-
If you need your grid to utilize a gap between columns / rows, you won't be able to use the gap property when using this method. You'd instead need to resort to some negative margin manipulation to handle the extra gap space.
-
-
stackoverflow.com stackoverflow.com
-
You use grid-area, so the place for the side nav is allocated at start. If you hide (or even delete) the side nav, that won't change anything about this. You have to do a little trick: Set the width for the first column to 0 and change the grid-gap because otherwise you will have a (not needed) gap at the left.
-
-
www.smashingmagazine.com www.smashingmagazine.com
-
This gives me the layout with the full-width image and two sections of content placed; however, if I add the background to the sections, it will stop above the row-gap between section and the full-width image.
-
- Jan 2021
-
serverfault.com serverfault.com
-
In case you changed something in the [Install] directive, you may need to run sudo systemctl reenable YOURUNITFILE in order to recreate the symlinks in the .target directories.
-
Just in case, daemon-reload isn't universal, have got to run systemctl --user daemon-reload for user services
-
-
github.com github.com
-
What I think is happening is that instantiating the component is immediately running the $: reactive code, which dispatches the event synchronously, before the parent component attaches the listener.
-
-
-
svelte.dev svelte.dev
-
Note that the value of canvas will be undefined until the component has mounted, so we put the logic inside the onMount lifecycle function.
Tags
Annotators
URL
-
-
github.com github.com
-
Note: your arrow must be an HTMLElement (not an SVGElement). To use an SVG arrow, wrap it in a <div> tag with the data-popper-arrow attribute.
Tags
Annotators
URL
-
-
atomiks.github.io atomiks.github.io
-
Elements with the disabled attribute aren't interactive, meaning users cannot focus, hover, or click them to trigger a tippy.
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
but you'll find that wherever you have an img tag inside a link, the image will have a red border under it.
-
if you set text-decoration: underline for all links then you will have to set text-decoration: none for special links which you don't need an underline.
-
-
stackoverflow.com stackoverflow.com
-
“JSONP is JSON with extra code” would be too easy for the real world. No, you gotta have little discrepancies. What’s the fun in programming if everything just works? Turns out JSON is not a subset of JavaScript. If all you do is take a JSON object and wrap it in a function call, one day you will be bitten by strange syntax errors, like I was today.
-
- Dec 2020
-
stackoverflow.com stackoverflow.com
-
Be careful when returning an object literal in the arrow function shortcut syntax like this. Don't forget the additional parens around the object literal!
-
-
developer.mozilla.org developer.mozilla.org
-
JSON.parse() does not allow single quotes
-
JSON.parse() does not allow trailing commas
-
If the reviver only transforms some values and not others, be certain to return all untransformed values as-is, otherwise, they will be deleted from the resulting object.
-
- Nov 2020
-
stackoverflow.com stackoverflow.com
-
delete will only work on properties whose descriptor marks them as configurable.
-
-
stackoverflow.com stackoverflow.com
-
Never use x && y || z when y can return a non-zero exit status.
-
-
stackoverflow.com stackoverflow.com
-
If it's closing the "window" likely you're putting the exit # command inside a function, not a script. (In which case use return # instead.)
-
-
mywiki.wooledge.org mywiki.wooledge.org
-
true && { echo true; false; } || { echo false; true; }
-
Bash (like all Bourne shells) has a special syntax for referring to the list of positional parameters one at a time, and $* isn't it. Neither is $@. Both of those expand to the list of words in your script's parameters, not to each parameter as a separate word.
-
However, this construct is not completely equivalent to if ... fi in the general case.
The caveat/mistake here is if you treat it / think that it is equivalent to if a then b else c. That is not the case if b has any chance of failing.
-
true && ((i++)) || ((i--))
-
Here we go again. [ is a command. It is not a syntactic marker that sits between if and some sort of C-like "condition". Nor is it used for grouping. You cannot take C-like if commands and translate them into Bash commands just by replacing parentheses with square brackets!
-
Tags
- bash
- good example
- shell scripting
- list of examples
- should not infer as a general rule
- illustrating problem
- how to do it correctly and avoid common mistakes/pitfalls
- trying to make a general rule out of something that only works for certain specific cases
- caveat
- distinction
- not the same thing (but easy to assume they are)
Annotators
URL
-
-
wresch.github.io wresch.github.io
-
Important caveat: in the combined expression, if the middle command has a non-zero exit status, then both the middle and the rightmost command end up getting executed.
I don't think that is surprising, is it? Since && and || have the same order of precedence. So I think this is more of a clarification than a caveat.
I think this is just because:
a && b || c is equivalent to: (a && b) || c (so of course c gets evaluated if
(a && b)
is false (that if eithera
orb
is false).I think they just mean, in this case:
bedmap && mv || fail
if
mv
fails, thenfail
still gets executed.Easier to see with a simpler example:
⟫ true && false || echo 'fail' fail ⟫ false && true || echo 'fail' fail
Better example/explanation here: https://hyp.is/-foxmCVXEeuhnLM-le_R4w/mywiki.wooledge.org/BashPitfalls
The caveat/mistake here is if you treat it / think that it is equivalent to if a then b else c. That is not the case if b has any chance of failing.
-
-
-
The potential problem: if second_task fails, third_task will not run, and execution will continue to the next line of code - next_task, in this example. This may be exactly the behavior you want. Alternatively, you may be intending that if second_task fails, the script should immediately exit with its error code. In this case, the best choice is to use a block - i.e., curly braces: first_task && { second_task third_task } next_task Because we are using the -e option, if second_task fails, the script immediately exits.
-
-
stackoverflow.com stackoverflow.com
-
But using internal api's is dangerous as these may change when you update svelte. If you decide to use this, add a line to your project Readme.md mentioning which internal api's you used and why. Try to write it using other methods when you can.
-
-
www.npmjs.com www.npmjs.com
-
It's important to only prepend it with ~, because ~/ resolves to the home directory.
-
- Oct 2020
-
stackoverflow.com stackoverflow.com
-
The only tricky part is that the error will come back as meta.submitError, so you need to check for both when displaying your error.
-
Some user experience issue with the proposed solution: This won't show up the inline field error message if you just hit on submit and other fields already contained errors since the code on the onSubmit won't be hit
-
-
svelte.dev svelte.dev
-
-
svelte.dev svelte.dev
-
-
svelte.dev svelte.dev
-
My version of https://svelte.dev/repl/9c7d12357a15457bb914705702f156d1?version=3.19.2 from https://github.com/sveltejs/svelte/issues/4586
to try to simplify and help me understand it better.
So the lack of synchronousness is only noticed inside handleClick.
By the time the DOM gets updated, it has a consistent/correct state.
In other words, the console.log shows wrong value, but template shows correct value. So this might not be an actual problem for many/most use cases.
-
-
svelte.dev svelte.dev
-
github.com github.com
-
github.com github.com
-
I too have been confused by behavior like this. Perhaps a clearly defined way to isolate atomic units with synchronous reactivity would help those of us still working through the idiosyncrasies of reactivity.
-
-
For performance reasons, $: reactive blocks are batched up and run in the next microtask. This is the expected behavior. This is one of the things that we should talk about when we figure out how and where we want to have a section in the docs that goes into more details about reactivity. If you want something that updates synchronously and depends on another value, you can use a derived store:
-
-
-
Anyway, If this is an expected behaviour, we should probably add an asterisk to the docs, describing the pitfall, because I believe many will be bitten by this.
-
-
svelte.dev svelte.dev
-
A simple rule of thumb: the name of the updated variable must appear on the left hand side of the assignment. For example this... const foo = obj.foo; foo.bar = 'baz';...won't update references to obj.foo.bar, unless you follow it up with obj = obj.
-
-
ponyfoo.com ponyfoo.comPony Foo1
-
Sometimes we can’t implement a solution that’s fully spec-compliant, and in those cases using a polyfill might be the wrong answer. A polyfill would translate into telling the rest of the codebase that it’s okay to use the feature, that it’ll work just like in modern browsers, but it might not in edge cases.
-
-
reactjs.org reactjs.org
-
The clean-up function runs before the component is removed from the UI to prevent memory leaks. Additionally, if a component renders multiple times (as they typically do), the previous effect is cleaned up before executing the next effect. In our example, this means a new subscription is created on every update.
Tags
Annotators
URL
-
-
final-form.org final-form.org
-
Note that if you are calling reset() and not specify new initial values, you must call it with no arguments. Be careful to avoid things like promise.catch(reset) or onChange={form.reset} in React, as they will get arguments passed to them and reinitialize your form.
-
-
www.npmjs.com www.npmjs.com
-
SSR Caveat
-
- Sep 2020
-
final-form.org final-form.org
-
Keep in mind that the values in meta are dependent on you having subscribed to them with the subscription prop.
-
-
github.com github.com
-
If calling query() results in calls to Svelte's context API, then it needs to be called synchronously during component initialization.
-
-
github.com github.com
-
I don't understand why it just launches the mutation once and then it throws the error Function called outside component initialization, the only way to make it work is to do something like $: result = mutation(...) but it doesn't make sense, I don't want to run the mutation after each keystroke.
-
-
svelte.dev svelte.dev
-
svelte.dev svelte.dev
-
Child can't update things by reassignment if you do:
<Child bind:things={things} />
but can if you do;
<Child bind:things={$object.things} />
-
-
-
Just throwing in <div class="{$$props.class || ''} otherChildClass"></div> seems the easiest, and it'll avoid undefined classes. I feel like many aren't noticing the undefined values getting inserted in their classes.
-
-
docs.google.com docs.google.com
-
It’s confusing enough, in fact, that the React team don’t trust you to write correct hooks code without using the special lint rules they devised.
But even that introduces new problems. The only difference between the app on the left and the one on the right is that on the right, I’m using a custom useLocalStorage hook instead of useState. It behaves equivalently. So why do I have this lint warning all of a sudden?
It turns out that certain built-in hooks have special treatment hard-coded in. So when you’re told that hooks are just functions, and you can do all the things you normally do with functions, it’s true… but there are some interesting caveats around that statement.
-
-
svelte.dev svelte.dev
-
In mapbox.js you'll see this line: const key = {};We can use anything as a key — we could do setContext('mapbox', ...) for example. The downside of using a string is that different component libraries might accidentally use the same one; using an object literal means the keys are guaranteed not to conflict in any circumstance (since an object only has referential equality to itself, i.e. {} !== {} whereas "x" === "x"), even when you have multiple different contexts operating across many component layers.
-
-
exploringjs.com exploringjs.com
-
The module specifier is always fixed. That is, you can’t change what you import depending on a condition. And you can’t assemble a specifier dynamically.
-
-
daveceddia.com daveceddia.com
-
In React, use the ternary operator (?) or a logical AND (&&). The logical AND can cause errors if the variable is not a boolean, so be careful with that one (or just stick with the ternary operator).
-
- Aug 2020
-
svelte.dev svelte.dev
-
Note that beforeUpdate will first run before the component has mounted, so we need to check for the existence of div before reading its properties.
Tags
Annotators
URL
-
- Jul 2020
-
svelte.dev svelte.dev
-
Because Svelte's reactivity is based on assignments, using array methods like .push() and .splice() won't automatically trigger updates.
-
-
bugs.ruby-lang.org bugs.ruby-lang.org
-
I guess much like Range literals in general, it's often needed to have parens around them.
Tags
Annotators
URL
-
- Jun 2020
-
medium.com medium.com
-
Caching is dangerous if not done correctly. For example, making decisions based on outdated data as if it was current.
-
-
www.howtogeek.com www.howtogeek.com
-
However, when you use an SD card as internal storage, Android formats the SD card in such a way that no other device can read it. Android also expects the adopted SD card to always be present, and won’t work quite right if you remove it.
-
- May 2020
-
en.wikipedia.org en.wikipedia.org
-
For instance, cor does not distribute over cand: compare (A cand B) cor C with (A cor C) cand (B cor C); in the case ¬A ∧ C , the second expression requires B to be defined, the first one does not
-
-
stackoverflow.com stackoverflow.com
-
Unfortunately, you cannot index an expression, which has a sub-query in it. If you want to index it, you need to create a function for it:
-
- Apr 2020
-
www.rubydoc.info www.rubydoc.info
-
As mentioned in StateMachines::Machine#state, you can define behaviors, like validations, that only execute for certain states. One important caveat here is that, due to a constraint in ActiveRecord's validation framework, custom validators will not work as expected when defined to run in multiple states.
-
-
www.iubenda.com www.iubenda.com
-
Google Tag Manager allows you to avoid tagging scripts as described below, although this is limited to a certain category of scripts – scripts that are not positional/do not define a position. It, therefore, does not handle embed scripts such as those related to advertising banners, youtube video widgets, facebook like buttons etc.
-
-
stackoverflow.com stackoverflow.com
-
You are correct: by default, git log -p shows you the merge commit, but does not even attempt to show a diff for it.
-
-
github.com github.com
-
Remember to call super in any subclasses that override teardown.
And yet the Rails core chose not to use RSpec, citing how it would be too easy to write
subject == expected
on accident?
-
-
github.com github.com
-
For Rails 5, note that protect_from_forgery is no longer prepended to the before_action chain, so if you have set authenticate_user before protect_from_forgery, your request will result in "Can't verify CSRF token authenticity." To resolve this, either change the order in which you call them, or use protect_from_forgery prepend: true.
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
This is pretty old now, but it should absolutely be mentioned that you can NOT always fall back to html - I suspect that MOST places that support markdown don't support html.
Not sure if this is true, though. GitHub and GitLab support HTML, for example.
Maybe comments on websites wouldn't normally allow it; I don't know. But they should. One can use this filter, for example, to make it safer.
-
-
www.troyhunt.com www.troyhunt.com
-
The rate limit can be just that - a limit rather than also dishing out punishment via the 24 hour block
Why can't a plain rate limit (without additional blocking) by used even if not authenticated? Seems like it could.
-
-
stackoverflow.com stackoverflow.com
-
If all you want to do is print the results you might be used to leaving out the -print action. You generally don't want to do that when using -prune.
-
which means that it'll also print out the name of the directory you're pruning, which usually isn't what you want. Instead it's better to explicitly specify the -print action if that's what you want
-
-
stackoverflow.com stackoverflow.com
-
Ruby 2.1 added local_variable_set, but that cannot create new local variables either
-
-
stackoverflow.com stackoverflow.com
-
This situation usually arises from external constraints not design choices such as my example with Sequel. My point is that assigning a value to a constant is allowed by Ruby in certain scopes and not others. It used to be up to the developer to choose wisely when to perform the assignment. Ruby changed on this. Not for everyone's good.
-
- Mar 2020
-
www.iubenda.com www.iubenda.com
-
Our WordPress plugin automatically blocks scripts that are generated on the server side (therefore returned by PHP by WordPress). Scripts that are inserted into the page via JavaScript after the loading process of that page are not and cannot be blocked automatically.
-
-
www.guidingtech.com www.guidingtech.com
-
YouTube will not collect and store info on the users, that are visiting your site, on its server unless they view the video
-
unless they view the video
Tags
Annotators
URL
-
-
www.davideocompany.com www.davideocompany.com
-
While you can't completely stop YouTube from installing cookies through the embedded videos on your site, enabling privacy-enhanced mode will allow You Tube to install the cookies only when a user actually clicks to play one of the videos
-
-
tonydye.typepad.com tonydye.typepad.comTony Dye1
-
The absolutely worst thing that can happen in your anti-spam solution is to block a good email and not let anybody know about it! Anti-spam solutions should always generate an NDR such that a legitimate sender can know their message didn't get through. (Of course, we know many legitimate users don't read nor understand NDRs, so there's still an issue) A really good anti-spam solution should not only generate an NDR, but that NDR should have an "escape clause" in it that gives that legitimate user a special way to get through the anti-spam solution, if they take some reasonable steps.
-
-
my.onetrust.com my.onetrust.com
-
Cookies may not be detected by scanner if the related tag is triggered by actions such as form submission, scroll depth, timing delay, etc. These tags will need to be controlled by manual methods.
With all these caveats listed, it makes me wonder for which tags auto-blocking does work. Only script tags inside of head?
They are a bit vague in their "how it works" description...
-
Cookies set by in-line scripting directly in the HTML is not supported by the auto-blocking functionality.
-
-
www.php.net www.php.net
-
However imagine we are creating a format string in a separate file, commonly because we would like to internationalize it and we rewrite it as: <?php$format = 'The %s contains %d monkeys';echo sprintf($format, $num, $location);?> We now have a problem. The order of the placeholders in the format string does not match the order of the arguments in the code. We would like to leave the code as is and simply indicate in the format string which arguments the placeholders refer to. We would write the format string like this instead: <?php$format = 'The %2$s contains %1$d monkeys';echo sprintf($format, $num, $location);?> An added benefit is that placeholders can be repeated without adding more arguments in the code.
-
$format = 'There are %d monkeys in the %s';
Compared to below:
$format = 'The %s contains %d monkeys'
-
- Jan 2020
-
guides.rubyonrails.org guides.rubyonrails.org
-
before_destroy callbacks should be placed before dependent: :destroy associations (or use the prepend: true option), to ensure they execute before the records are deleted by dependent: :destroy.
-
-
www.red-gate.com www.red-gate.com
-
Please do not make the mistake of trying to reduce the HAVING clause with a little false relational algebra to: 1 HAVING COUNT(PS1.plane_name) = COUNT(H1.plane_name) because it does not work; it will tell you that the hangar has (n) planes in it and the pilot_name is certified for (n) planes, but not that those two sets of planes are equal to each other.
-
- Dec 2019
-
-
When you do sudo you are running commands as root, another user in another shell and hence all of the setup that RVM has done for you is ignored while the command runs under sudo (such things as GEM_HOME, etc...). So to reiterate, as soon as you 'sudo' you are running as the root system user which will clear out your environment as well as any files it creates are not able to be modified by your user and will result in strange things happening
-
- Aug 2019
-
developer.mozilla.org developer.mozilla.org
-
The parentheses ( ... ) around the assignment statement are required when using object literal destructuring assignment without a declaration. {a, b} = {a: 1, b: 2} is not valid stand-alone syntax, as the {a, b} on the left-hand side is considered a block and not an object literal.
-
Your ( ... ) expression needs to be preceded by a semicolon or it may be used to execute a function on the previous line.
-