Daniel Schwarz 2 months ago
Front-end development
console.log(5 % 2); // 1

Didn't know about this!

2 fits into 5 twice, with 1 left over.
Daniel Schwarz 2 months ago
Front-end development
Simple, but the radix baffles me 🤷‍♂️

parseInt("String", 10);
Daniel Schwarz 2 months ago
Front-end development
Reaffirmed knowledge of...

String.indexOf()
Ufuk 2 months ago
Goal
✅ Completed the goal:
Django app will be soon
Mayank *Business* 2 months ago
Business
eCommerce#4
Today I learned, Most of the businesses use two major platforms, Shopify Or Woocommerce(WordPress).
I personally have 2 Woocommerce Stores, and I prefer woocommerce over Shopify all the way because of the flexibility & Transparency.
Daniel Schwarz 2 months ago
Front-end development
Awesome! I didn't know this :)

chips.replace(new RegExp('chips', 'g'), 'deep fried potato slices');

Daniel Schwarz 2 months ago
Front-end development
Converted...

const endDate = ("0" + endDateTime.getDate()).slice(-2);

Into...

const endDate = (endDateTime.getDate() + "").padStart(2, "0");

Because I learned .padStart(); and this way is more readable.
Dmitrii Pashutskii 2 months ago
Front-end development
Learning a lot about Gatsby and Next.js internal things. I'm using these two for my next projects.
Daniel Schwarz 2 months ago
Front-end development
Still learning some JavaScript things from Vanilla JS Toolkit, but didn't really understand custom events :(
juniusfree 3 months ago
Computer science
Mayank *Business* 3 months ago
Business
eCommerce#3
NDR means Non-Delivery Report, It's the section in every shipping service, It contains all the orders which are shipped by you but for some reason is not accepted by the customer or It has a Fake address. The business has to bear the charges of COD, Shipping, Packaging, Etc. To prevent the NDR orders, Businesses call them and ask them to confirm the address. Most of the fake orders are unable to say the correct address they put while ordering because it's fake, then the businesses don't ship those orders and put them in the canceled section.
Veronika 3 months ago
Back-end development
I learned to appreciate system tests and test-driven development a bit more today 😅

Writing tests before figuring out what is wrong saved me a bit of headache today.
Kevser 3 months ago
Back-end development
Django get database settings from file

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'OPTIONS': {
            'read_default_file': '.my.cnf',
        },
    }
}


.my.cnf file 
[client]
database = blog_data
user = djangouser
password = your_actual_password
default-character-set = utf8
Kevser 3 months ago
DevOps

Error Fix 


Osx virtualenv python error after software update

Error message:
➜ xxxxxx git:(master) ✗ virtualenv env
zsh: no such file or directory: /Library/Frameworks/Python.framework/Versions/3.9/bin/virtualenv

➜  xxxxx git:(master) ✗ pip install virtualenv
Requirement already satisfied: virtualenv in /usr/local/lib/python3.9/site-packages (20.2.2)
Requirement already satisfied: appdirs<2,>=1.4.3 in /usr/local/lib/python3.9/site-packages (from virtualenv) (1.4.4)
Requirement already satisfied: six<2,>=1.9.0 in /usr/local/lib/python3.9/site-packages (from virtualenv) (1.15.0)
Requirement already satisfied: filelock<4,>=3.0.0 in /usr/local/lib/python3.9/site-packages (from virtualenv) (3.0.12)
Requirement already satisfied: distlib<1,>=0.3.1 in /usr/local/lib/python3.9/site-packages (from virtualenv) (0.3.1)

Solution:

python3 -m venv venv
source ./venv/bin/activate
or use pyenv and delete brew python versions because error is caused by brew

Kevser 3 months ago
Back-end development
Create mobile and desktop request  on Python 

Return => response , decoded response body

mobile_user_agent = ''
desktop_user_agent = ''
def create_request(url, is_mobile):
    try:
        if is_mobile:
            res = requests.get(url, headers={'user-agent': mobile_user_agent})

        res = requests.get(url, headers={'user-agent': desktop_user_agent})

        if res.status_code is not 200:
            return res, ''

        res_page_source = res.content.decode('utf-8')
        return res, res_page_source
    except Exception as ex:
        print(ex)
        return "", ""

Kevser 3 months ago
DevOps
Serverless installation

$ npm install -g serverless


Serverless AWS Configuration

$ serverless config credentials --provider aws --key <aws-key> -secret <aws-secret-key> -profile custom-profile

Serverless Python Requirements Plugin Installation

$ serverless plugin install -n serverless-python-requirements

Serverless Lambda  Example with Python Plugin
service: python-lambda-example

provider:
  name: aws
  runtime: python3.6
  region: us-east-1
  timeout: 900
  memorySize: 1024

functions:
  hello:
    handler: handler.hello
    description: Description for python lambda
    layers:
      - <layer arn>

plugins:
  - serverless-python-requirements
custom:
  pythonRequirements:
    dockerizePip: non-linux

Serverless Deployment
$ serverless deploy

Serverless Deployment History

$ serverless deploy list

Serverless Invoke


# local
$ serverless invoke local --function functionName

#aws
$ serverless invoke --function functionName --stage dev --region us-east-1

# aws with data
$ serverless invoke --function functionName --stage dev --region us-east-1 --data "hello world"
Dmitrii Pashutskii 3 months ago
Foreign language
Continue improving English with "Grammar in Use". Today was about "I wish I had/knew etc" statements.
Stefanni 3 months ago
Goal
✅ Completed the goal:
Read MicroSaaS Guide
Stefanni 3 months ago
Business
I started applying the techniques from this post https://stackingthebricks.com/cant-find-audience/ for my 7-day plant-based diet challenge email course copy writing. It's been interesting exploring more about the problems my audience have and what are the solutions they use for them. It's a WIP and I am getting better at it.