Snippets Collections
dataframe['column_name'].value_counts().plot(kind='bar')
plt.show()
INSERTING ONE AND MANY
db.places.insertOne({})
db.places.insertMany({})

UPDATING - ONE AND MANY
db.places.updateOne({"country": "India"}, {$set: {"continent": "Europe"}})
db.places.updateMany({"country": "India"}, {$set: {"flag": "Updated Flag"}})

DELETING
db.places.deleteOne({"continent": "Africa"})
db.places.deleteMany({"continent": "Africa"})
db.places.findAndDelete({})

FINDING
db.students.find({"name":"Andy"})
db.students.find({"name":"Mike"})

FINDING using $OR and $IN
this will return entries that have hobbies of baseball OR MAC and Linux users
db.students.find( { $or: [ { "hobbies": { $in: ["Baseball"]}}. { "os" { $in: ["Mac", "Lin"]}}]})

also compatible with SOME regex expressions

SORTING:
db.animals.find().sort({weight: -1}); <== this is descending, a positive value is ascending



MYSQL
DB_NAME=
DB_PASSWORD=
DB_USER=root

MONGODB
Open Mongosh - copy string and add to:

-- config file notes

// Config is the only access of 'dotenv'

import dotenv from "dotenv";

dotenv.config();

export default {
  port: process.env.PORT || 3000,
  db: process.env.DB_CLIENT_URL,
};
npm install --legacy-peer-deps
npm cache clear --force
visitors = p.visitors.customers.where(tags: 'UNSUBSCRIBE 2021')
visitor_ids = visitors.pluck(:id);1

STATUSES_FOR_DELETION = [Automations::Trigger::Status::NOT_EXECUTED, Automations::Trigger::Status::RETRIGGERED].freeze
scheduled_steps = Automations::ScheduledStep.in(campaign_id: campaign_ids).in('triggers.visitor_id': visitor_ids)
scheduled_steps.map do |step|
  step.triggers.where(visitor: @visitor).in(status: STATUSES_FOR_DELETION).destroy_all
end

Mails::SingleEmail.where(project: p, sent_at: nil, processing: false).in(recipient_id: visitor_ids).destroy_all

Debug::MergeLog.where(project: p).in(legacy_visitor: visitor_ids).destroy_all

visitors.each.with_index do |visitor, index|
  visitor.events.destroy_all
  visitor.destroy

  puts index if index % 1000 == 0
end
{%- for block in section.blocks -%}
{%- assign product = all_products[block.settings.product] -%}
 <div class="img">{{ product.title }}</div>
{%- endfor -%}
<div id="section-{{ section.id }}">
  {%- for block in section.blocks -%}
    <ul>
      <li class="cate"> {{ block.settings.cate }} </li>
      <li class="date"> {{ block.settings.date }} </li>
      <li class="text"> {{ block.settings.text }} </li>
    </dl>
  {%- endfor -%}
</div>

{% schema %}
  {
    "name": "Top-topics",//セクション名
    "class": "top-topics",//セクションに自動で追加されるclass名
    "blocks": [// 画像や商品など数が増える可能性がある設定を記述する
      {
        "type": "text",
        "name": "Topic",//入力画面でのタイトル
        "limit": 5,
        "settings": [
          {
            "type": "select",
            "id": "cate",
            "label": "Category",
            "options": [
              {
                "value": "topics",
                "label": "Topics"
              },
              {
                "value": "news",
                "label": "News"
              }
            ],
            "default": "topics"
          },
          {
            "id": "date",
            "type": "text",
            "label": "日付を入力",
            "default": "2021.03.27"
          },
          {
            "id": "text",
            "type": "text",
            "label": "テキストを入力",
            "default": "テキストを入力"
          }
        ]
      }
    ],
    "presets":[
      {
        "category": "Text",//管理画面のセクション一覧のグループに表示される名前
        "name": "Top topics"
      }
    ]
  }
{% endschema %}

{% stylesheet %}

{% endstylesheet %}

{% javascript %}
{% endjavascript %}
star

Sat Aug 28 2021 16:52:53 GMT+0000 (UTC)

#plaintext
star

Sat Aug 28 2021 14:16:51 GMT+0000 (UTC)

#plaintext
star

Tue Aug 03 2021 18:25:07 GMT+0000 (UTC)

#plaintext
star

Wed Jul 07 2021 09:19:01 GMT+0000 (UTC)

#plaintext
star

Tue Apr 27 2021 07:16:12 GMT+0000 (UTC)

#plaintext
star

Tue Apr 27 2021 04:52:33 GMT+0000 (UTC)

#plaintext

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension