Elad Shechter's RESET

/****** Elad Shechter's RESET *******/
/*** box sizing border-box for all elements ***/
a{text-decoration:none; color:inherit; cursor:pointer;}
button{background-color:transparent; color:inherit; border-width:0; padding:0; cursor:pointer;}
input::-moz-focus-inner {border:0; padding:0; margin:0;}
ul, ol, dd{margin:0; padding:0; list-style:none;}
h1, h2, h3, h4, h5, h6{margin:0; font-size:inherit; font-weight:inherit;}
cite {font-style:normal;}
fieldset{border-width:0; padding:0; margin:0;}

Update and return updated document

$user = $collection->findOneAndUpdate(['_id' => $post['_id']], ['$set' => $post], ['returnDocument' => \MongoDB\Operation\FindOneAndUpdate::RETURN_DOCUMENT_AFTER]);


C:\UKY\674\map674-module-02-mup223>conda env create -f environment.yml
Collecting package metadata (repodata.json): failed

CondaHTTPError: HTTP 504 GATEWAY_TIMEOUT for url <https://conda.anaconda.org/anaconda-fusion/noarch/repodata.json>
Elapsed: 00:59.666429
CF-RAY: 4fa195080ef3ba40-ATL

A remote server error occurred when trying to retrieve this URL.

A 500-type error (e.g. 500, 501, 502, 503, etc.) indicates the server failed to
fulfill a valid request.  The problem may be spurious, and will resolve itself if you
try your request again.  If the problem persists, consider notifying the maintainer
of the remote server.

获取一行 sed

sed -n 435227p web-debug.log.21 > args21.txt


<!DOCTYPE html>
<html lang="ja">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="./css/style.css">
<meta name="description" content="ディスクリプション">
<!-- <link rel="icon" href="./img/favicon.ico"> -->

<!-- header -->
<header id="header">
<div class="inner">

<h1 class="header-logo"><a href=""><img src="./img/header-logo.png" alt="ロゴ"></a></h1>

<!-- header-nav -->
<nav class="header-nav">
<ul class="header-list">
	<li><a href="#">MENU1</a></li>
	<li><a href="#">MENU2</a></li>
	<li><a href="#">MENU3</a></li>
	<li><a href="#">MENU4</a></li>
	<li><a href="#">MENU5</a></li>
</nav><!-- /header-nav -->

</div><!-- /inner -->
</header><!-- /header -->

<!-- drawer -->
<div class="drawer">
<div class="drawer-open"><span></span></div>
<div class="drawer-close"></div>

<!-- drawer-content -->
<div class="drawer-content">

git cheatsheet

# cheat sheet for git
## ssh key
1. [how to generate ssh key](https://www.jianshu.com/p/259773014e03) for more info.
# ssh key resides in .ssh folder
ls ~/.ssh
# id_rsa is private key, id_rsa.pub is the public one.
# gen new ssh key
ssh-keygen -t rsa -C "your_email@example.com"
# the "email@example.com" is just for comment, anything else can put here.


2. [git ssh key](https://blog.csdn.net/lqlqlq007/article/details/78983879)

## git ignore
1. [git-ignore-tuts](https://www.atlassian.com/git/tutorials/saving-changes/gitignore)


Loading Our Test Data From a CSV File We can load our test data from a CSV file by following these steps: First, we have to create a CSV file that contains our test data and put this file to the classpath. When we add our test data to the created CSV file, we have to follow these rules: One line must contain all method parameters of one method invocation. The different method parameters must be separated with a comma. The values found from each line must use the same order as the method parameters of our test method. The test-data.csv file configures the test data that is passed to our test method. This file is found from the src/test/resources directory, and its content looks as follows: 1,1,2 2,3,5 3,5,8 Second, we have to annotate our test method with the @CsvFileSource annotation and configure the location of our CSV file. After we have done this, the source code of our test class looks as follows:
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
@DisplayName("Should pass the method parameters provided by the test-data.csv file")
class CsvFileSourceExampleTest {
    @DisplayName("Should calculate the correct sum")
    @ParameterizedTest(name = "{index} => a={0}, b={1}, sum={2}")
    @CsvFileSource(resources = "/test-data.csv")
    void sum(int a, int b, int sum) {
        assertEquals(sum, a + b);

My first Cacher snippet

Saved from chrome-extension://aiiaandmkmekfhembfoghdnfiiiedhhk/#/tutorial
// In Javascript
console.log('Hello Cacher!');

Comparing Characters

// Complete the alternatingCharacters function below.
    static int alternatingCharacters(String s) {

        int deleted = 0;
        for(int i=0; i<s.length()-1;i++){
            if(s.charAt(i) == s.charAt(i+1)) deleted++;

        return deleted;


Odoo mail template

### For loop

%for lines in object.tracking_numbers

Universal Fields Validator

// object validation rules
const schema = {
  first: {
  last: {

// universal validation function
const validate = (schema, values) => {
  for(field in schema) {
    if(schema[field].required) {
      if(!values[field]) {
        return false;
  return true;

console.log(validate(schema, {first:'Bruce'})); // false
console.log(validate(schema, {first:'Bruce',last:'Wayne'})); // true

appstore mail uyarısı

post_install do |installer|
   installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
       config.build_settings['ARCHS'] = '$ARCHS_STANDARD_64_BIT'

Original Tooltip Window

# -*- coding: utf-8 -*-

import sys
import os
import os.path

from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtUiTools import QUiLoader

ZOOM_MIN = -0.5

# MainUI

class UISample(QtWidgets.QDialog):

    def __init__(self, parent=None):

        super(UISample, self).__init__((parent))

        self.view = NodeView()
        layout  = QtWidgets.QVBoxLayout()

        self.scene = NodeScene()

        self.resize(400, 300)

        # Item追加
        item = BaseNodeItem()

class NodeView(QtWidgets.QGraphicsView):

    def __init__(self, parent=None):
        super(NodeView, self).__init__(parent)


    def wheelEvent(self, e):
        delta = e.delta()
        adjust = (delta / 120) * 0.1

    def s

Heroku: Update App Name

* If you change the name of your project in the heroku website you'll need to update
it in the terminal also:
git remote rm heroku
git remote add heroku git@github.com:yourappname.git

Attach Footer to Bottom

body {
  padding-bottom: heightOfFooter;

footer {
  height: heightOfFooter;
  position: fixed;
  bottom: 0;
  width: 100%;

Validador DNI, CIF y NIE

[Javascript] Validador DNI, CIF y NIE
const DNI_REGEX = /^(\d{8})([A-Z])$/;
const CIF_REGEX = /^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/;
const NIE_REGEX = /^[XYZ]\d{7,8}[A-Z]$/;

function validateDocumentID(str) {
    str = str.toUpperCase().replace(/\s/, '');
    let valid = false;
    const type = this.documentType(str);

    switch (type) {
        case 'dni': valid = this.validDNI(str); break;
        case 'nie': valid = this.validNIE(str); break;
        case 'cif': valid = this.validCIF(str); break;
        default: break;

    return { type, valid };

function documentType(str) {
    if (str.match(this.DNI_REGEX)) {
        return 'dni';
    if (str.match(this.CIF_REGEX)) {
        return 'cif';
    if (str.match(this.NIE_REGEX)) {
        return 'nie';

function validDNI(dni) {
    const dni_letters = 'TRWAGMYFPDXBNJZSQVHLCKE';
    const letter = dni_letters.charAt(parseInt(dni, 10) % 23);

    return letter === dni.charAt(8);

function validNIE(nie) {
    let niePrefix = nie.charA