60 Matching Annotations
  1. Nov 2024
  2. Aug 2024
  3. Jan 2024
    1. I've found that a lot of um Pioneers who have had brilliant ideas and have fought through and you know sort of um uh spent a lot of energy in their life pushing 00:42:00 some someone with some new idea those people are often the most resistant to other new ideas it's amazing

      for - resonates with - existing meme

      resonates with - existing meme - yesterday's revolutionaries become today's old guard

      • What I tell my students just be very careful with people who are
        • very smart and
        • very successful
      • They know their stuff they're not necessarily calibrated on your stuff

      comment - Lebenswelt and multimeaningverse

    1. Instance methods Instances of Models are documents. Documents have many of their own built-in instance methods. We may also define our own custom document instance methods. // define a schema const animalSchema = new Schema({ name: String, type: String }, { // Assign a function to the "methods" object of our animalSchema through schema options. // By following this approach, there is no need to create a separate TS type to define the type of the instance functions. methods: { findSimilarTypes(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); } } }); // Or, assign a function to the "methods" object of our animalSchema animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); }; Now all of our animal instances have a findSimilarTypes method available to them. const Animal = mongoose.model('Animal', animalSchema); const dog = new Animal({ type: 'dog' }); dog.findSimilarTypes((err, dogs) => { console.log(dogs); // woof }); Overwriting a default mongoose document method may lead to unpredictable results. See this for more details. The example above uses the Schema.methods object directly to save an instance method. You can also use the Schema.method() helper as described here. Do not declare methods using ES6 arrow functions (=>). Arrow functions explicitly prevent binding this, so your method will not have access to the document and the above examples will not work.

      Certainly! Let's break down the provided code snippets:

      1. What is it and why is it used?

      In Mongoose, a schema is a blueprint for defining the structure of documents within a collection. When you define a schema, you can also attach methods to it. These methods become instance methods, meaning they are available on the individual documents (instances) created from that schema.

      Instance methods are useful for encapsulating functionality related to a specific document or model instance. They allow you to define custom behavior that can be executed on a specific document. In the given example, the findSimilarTypes method is added to instances of the Animal model, making it easy to find other animals of the same type.

      2. Syntax:

      Using methods object directly in the schema options:

      javascript const animalSchema = new Schema( { name: String, type: String }, { methods: { findSimilarTypes(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); } } } );

      Using methods object directly in the schema:

      javascript animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); };

      Using Schema.method() helper:

      javascript animalSchema.method('findSimilarTypes', function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); });

      3. Explanation in Simple Words with Examples:

      Why it's Used:

      Imagine you have a collection of animals in your database, and you want to find other animals of the same type. Instead of writing the same logic repeatedly, you can define a method that can be called on each animal instance to find similar types. This helps in keeping your code DRY (Don't Repeat Yourself) and makes it easier to maintain.

      Example:

      ```javascript const mongoose = require('mongoose'); const { Schema } = mongoose;

      // Define a schema with a custom instance method const animalSchema = new Schema({ name: String, type: String });

      // Add a custom instance method to find similar types animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); };

      // Create the Animal model using the schema const Animal = mongoose.model('Animal', animalSchema);

      // Create an instance of Animal const dog = new Animal({ type: 'dog', name: 'Buddy' });

      // Use the custom method to find similar types dog.findSimilarTypes((err, similarAnimals) => { console.log(similarAnimals); }); ```

      In this example, findSimilarTypes is a custom instance method added to the Animal schema. When you create an instance of the Animal model (e.g., a dog), you can then call findSimilarTypes on that instance to find other animals with the same type. The method uses the this.type property, which refers to the type of the current animal instance. This allows you to easily reuse the logic for finding similar types across different instances of the Animal model.

      Certainly! Let's go through each part and explain it in simple terms: ### 1. `this` in Mongoose: - **What is `this`?** In JavaScript, `this` refers to the current context or object. In Mongoose, particularly within methods and middleware functions, `this` represents the instance (document) the function is currently operating on. - **Why is it used?** `this` is used to access and modify the properties of the current document. For example, in a Mongoose method, `this` allows you to refer to the fields of the specific document the method is called on. ### 2. Example: Let's use the `userSchema.pre("save", ...)`, which is a Mongoose middleware, as an example: ```javascript userSchema.pre("save", async function (next) { if (!this.isModified("password")) { next(); } else { this.password = await bcrypt.hash(this.password, 10); next(); } }); ``` - **Explanation in Simple Words:** - Imagine you have a system where users can sign up and set their password. - Before saving a new user to the database, you want to ensure that the password is securely encrypted (hashed) using a library like `bcrypt`. - The `userSchema.pre("save", ...)` is a special function that runs automatically before saving a user to the database. - In this function: - `this.isModified("password")`: Checks if the password field of the current user has been changed. - If the password is not modified, it means the user is not updating their password, so it just moves on to the next operation (saving the user). - If the password is modified, it means a new password is set or the existing one is changed. In this case, it uses `bcrypt.hash` to encrypt (hash) the password before saving it to the database. - The use of `this` here is crucial because it allows you to refer to the specific user document that's being saved. It ensures that the correct password is hashed for the current user being processed. In summary, `this` in Mongoose is a way to refer to the current document or instance, and it's commonly used to access and modify the properties of that document, especially in middleware functions like the one demonstrated here for password encryption before saving to the database.

    Tags

    Annotators

    URL

      • for: COP28 talk - later is too late, Global tipping points report, question - are there maps of feedbacks of positive tipping points?, My Climate Risk, ICICLE, positive tipping points, social tipping points

      • NOTE

        • This video is not yet available on YouTube so couldn't not be docdropped for annotation. So all annotations are done here referred to timestamp
      • SUMMARY

        • This video has not been uploaded on youtube yet so there is no transcription and I am manually annotating on this page.

        • Positive tipping points

          • not as well studied as negative tipping points
          • cost parity is the most obvious but there are other factors relating to
            • politics
            • psychology
          • We are in a path dependency so we need disruptive change
      • SPEAKER PANEL

        • Pierre Fredlingstein, Uni of Exeter - Global carbon budget report
        • Rosalyn Conforth, Uni of Reading - Adaptation Gap report
        • Tim Lenton, Uni of Exeter - Global Tipping Report
      • Global Carbon Budget report summary

      • 0:19:47: Graph of largest emitters

        • graph
        • comment
          • wow! We are all essentially dependent on China! How do citizens around the world influence China? I suppose if ANY of these major emitters don't radically reduce, we won't stay under 1.5 Deg C, but China is the biggest one.
      • 00:20:51: Land Use Emissions

      • three countries represent 55% of all land use emissions - Brazil - DRC - Indonesia

      • 00:21:55: CDR

        • forests: 1.9 Gt / 5% of annual Fossil Fuel CO2 emissions
        • technological CDR: 0.000025% of annual Fossil Fuel CO2 emissions
      • 00:23:00: Remaining Carbon Budget

        • 1.5 Deg C: 275 Gt CO2
        • 1.7 Deg C. 625 Gt CO2
        • 2.0 Deg C. 1150 Gt CO2
      • Advancing an Inclusive Process for Adaptation Planning and Action

      • adaptation is underfinanced. The gap is:

        • 194 billion / year
        • 366 billion / year by 2030
      • climate change increases transboundary issues
        • need transboundary agreements but these are absent
        • conflicts and migration are a result of such transboundary climate impacts
        • people are increasing climate impacts to try to survive due to existing climate impacts

      -00:29:46: My Climate Risk Regional Hubs - Looking at climate risks from a local perspective. - @Nate, @SoNeC - 00:30:33 ""ICICLE** storyllines - need bottom-up approach (ICICLE - Integrated Climate Livelihood and and Environment storylines)

      • 00:32:58: Global Tipping Points

      • 00:33:46: Five of planetary systems can tip at the current 1.2 Deg C

        • Greenland Ice Sheet
        • West Antarctic
        • Permafrost
        • Coral Reefs - 500 million people
        • Subpolar Gyre of North Atlantic - ice age in Europe
          • goes in a decade - like British Columbia climate
      • 00:35:39

        • risks go up disproportionately with every 0.1 deg C of warming. There is no longer a business-as-usual option now. We CANNOT ACT INCREMENTALLY NOW.
      • 00:36:00

        • we calculate a need of a speed up of a factor of 7 to shut down greenhouse gas emissions and that is done through positive tipping points.

      -00:37:00 - We have accelerating positive feedbacks and if we coordinate policy changes with consumer behavior change and business behavior change to reinforce these positive feedbacks, we can help accelerate change in the other sectors of the global economy responsible for all the other emissions

      • 00:37:30

        • in the report we walk you through the other sectors, where their tipping points are and how we have to act to trigger them. This is the only viable path out of our situation.
      • 00:38:10

        • Positive tipping points can also reinforce each other
        • Question: Are there maps of the feedbacks of positive tipping points?
        • Tim only discusses economic and technological positive tipping points and does not talk about social or societal
  4. Nov 2022
    1. Note that you can address this by creating signal handlers in Bash to actually do the forwarding, and returning a proper exit code. On the other hand that's more work, whereas adding Tini is a few lines in your Dockerfile.
  5. Aug 2022
  6. Jul 2022
    1. The energy sector contains a large number of long‐lived and capital‐intensive assets. Urban infrastructure, pipelines, refineries, coal‐fired power plants, heavy industrial facilities, buildings and large hydro power plants can have technical and economic lifetimes of well over 50 years. If today’s energy infrastructure was to be operated until the end of the typical lifetime in a manner similar to the past, we estimate that this would lead to cumulative energy‐related and industrial process CO2 emissions between 2020 and 2050 of just under 650 Gt CO2. This is around 30% more than the remaining total CO2 budget consistent with limiting global warming to 1.5 °C with a 50% probability (see Chapter 2)

      Emissionen durch die Verfeuerung der vorhandenen Assets: 650 Gigatonnen

      Das bedeutet eine 30prozentige Überschreitung des CO2-Budgets für 50% Wahrscheinlichkeit des 1,5°-Ziels

  7. Jun 2022
    1. I'd love something similar to automatically crawl and index every site I visit. I'm forever losing stuff. I know I saw it but I can't remember where. reply parent chillpenguin () 1 hour ago on I use BrowserParrot for this. Works really well.https://www.browserparrot.com/ reply parent thinkmassive () 2 hours ago on ArchiveBox documents how to automatically archive links from your browser history:https://github.com/ArchiveBox/ArchiveBox/wiki/Usage#Import-l... reply parent mttjj () 5 hours ago on This is Mac only and I have no affiliation other than I like this developer but your request reminded me that he just launched this app: https://andadinosaur.com/launch-history-book reply parent akrymski () 1 hour ago on I use Google for this. It's really annoyingly good at finding previously visited pages. reply parent asselinpaul () 3 hours ago on https://heyday.xyz comes to mind reply parent fudged71 () 2 hours ago on Vortimo
  8. Feb 2022
  9. Jan 2022
    1. James 💙 Neill - 😷 🇪🇺🇮🇪🇬🇧🔶. (2022, January 23). Of 51,141 deaths due to ischaemic heart diseases 32,872 (64.3%) had pre-existing conditions.💔 Do those 33k heart disease deaths not count? Or is an absence of pre-existing conditions only required for Covid deaths...😡⁉️ Source: ONS England 2019 [Tweet]. @jneill. https://twitter.com/jneill/status/1485327886164844546

  10. Dec 2021
  11. Nov 2021
  12. Oct 2021
  13. Sep 2021
    1. The VTE widget was originally designed as the back-end for Gnome Terminal but was fortunately designed as a GTK widget so that other terminal emulator applications could leverage it instead of rolling their own. Many popular Linux terminal emulators use this component.

      .

  14. Jul 2021
  15. Jun 2021
    1. Rather than write new tooling we decided to take advantage of tooling we had in place for our unit tests. Our unit tests already used FactoryBot, a test data generation library, for building up test datasets for a variety of test scenarios. Plus, we had already built up a nice suite of helpers that we coud re-use. By using tools and libraries already a part of the backend technology’s ecosystem we were able to spend less time building additional tooling. We had less code to maintain because of this and more time to work on solving our customer’s pain points.
  16. Apr 2021
    1. But in all this incongruous abundance you'll certanly find the links to expect It's just what is wanted: the tool, which is traditionally used to communicate automatically with interactive programs. And as it always occurs, there is unfortunately a little fault in it: expect needs the programming language TCL to be present. Nevertheless if it doesn't discourage you to install and learn one more, though very powerful language, then you can stop your search, because expect and TCL with or without TK have everything and even more for you to write scripts.
  17. Mar 2021
  18. Feb 2021
    1. My reasoning for not gemifying ActiveForm is that the custom not-rails-core logic is relatively small
    2. I've utilized as many Rails modules as I can to make maintenance a lot easier as I just have to update Rails and I get the updates for free. By utilizing Rails core modules, it's a really small library - there are only 10 methods in the Base module!
    1. I'd like to know specifically what you were aiming to achieve with this Gem as opposed to simply using https://github.com/apotonick/reform? I am happy to help contribute, but equally if there is a gem out there that already does the job well, I'd like to know why we shouldn't just use that.
  19. Nov 2020
    1. I've only done components that need to/can be Svelte-ified. For some things, like RTL and layout grid, you can just use the MDC packages.
    2. This is Sass based, and therefore doesn't require Svelte components

      Just because we could make Svelte wrapper components for each Material typography [thing], doesn't mean we should.

      Compare:

      • material-ui [react] did make wrapper components for typography.

        • But why did they? Is there a technical reason why they couldn't just do what svelte-material-ui did (as in, something technical that Svelte empowers/allows?), or did they just not consider it?
      • svelte-material-ui did not.

        • And they were probably wise to not do so. Just reuse the existing work from the Material team so that there's less work for you to keep in sync and less chance of divergence.
  20. Oct 2020
  21. Sep 2020
    1. Links are just <a> elements, rather than framework-specific <Link> components. That means, for example, that this link right here, despite being inside a blob of markdown, works with the router as you'd expect
    1. You can construct both by setting other properties inside the Promise callbacks, but we have {#await} and I feel like it should be used for this, instead of special casing the logic every time.
    1. The complaint is that by choosing less powerful languages, template-based frameworks are then forced to reintroduce uncanny-valley versions of those constructs in order to add back in missing functionality, thereby increasing the mount of stuff people have to learn.
    2. In general, I'm unpersuaded by these arguments (learning curve is determined not just by unfamiliar syntax, but by unfamiliar semantics and APIs as well, and the frameworks in question excel at adding complexity in those areas).
    3. One of the arguments that's frequently deployed in favour of JSX-based frameworks over template-based ones is that JSX allows you to use existing language constructs:
  22. Aug 2020
  23. Jul 2020
  24. Jun 2020
    1. If you've found a problem in Ruby on Rails which is not a security risk, do a search on GitHub under Issues in case it has already been reported. If you are unable to find any open GitHub issues addressing the problem you found, your next step will be to open a new one.
  25. May 2020
  26. Oct 2019
    1. I'd say that "dump" in the CS sense, both as noun and verb, is merely another application of its preexisting meanings even without the vulgar one, particularly the ones related to unloading/releasing contents. (For example, "dump truck".)
    2. For some geeky reason, the computer programming world has long maintained a tradition of using words in new ways, with a studied obliviousness to their prior, rude meanings: for example, 'dump'. 'Falsey' is merely another word in this long, and quite useful, tradition.
  27. Jan 2019
  28. www.at-the-intersection.com www.at-the-intersection.com
    1. ike I said, using the trading view chart is the best thing that you guys could have done. It's not, you know, like I said, don't, don't reinvent the wheel. It's already perfectly round. This one works great.
    2. But I'm also not looking at necessarily reinvent the wheel, but the tools are offering specific applications, do a really good job at what they do.
    3. Um, instead of building it from scratch cause they've done a good job and I believe that have a easier enough api to pull in, uh, those tools into your own