Skip to content

Instantly share code, notes, and snippets.

View hieuhani's full-sized avatar
🎯
The beginning is the end and the end is the beginning

Hieu Tran hieuhani

🎯
The beginning is the end and the end is the beginning
View GitHub Profile
import scrapy
class DienmayxanhSpider(scrapy.Spider):
name = "dienmayxanh"
def start_requests(self):
urls = [
"https://www.dienmayxanh.com",
]
Django==4.0.5
djangorestframework==3.13.1
Pillow==9.1.1
class SaleOrder(models.Model):
_inherit = "sale.order"
@api.model_create_multi
def create_from_po(self, vals_list):
partner = self.env['res.partner'].search([('name', 'ilike', self.env.user.name)], limit=1)
if not partner:
raise ValidationError(_('Partner database is not configured properly'))
product_codes = set()
uom_names = set()
@hieuhani
hieuhani / release.sh
Created April 5, 2020 08:43
Release to latest branch
#!/bin/sh
yarn install
yarn build
git checkout --orphan latest
mkdir release_tmp
mv packages/ui/dist release_tmp/dist
mv packages/ui/package.json release_tmp
rm -rf packages
rm `find . -type f | grep -Ev '.git|release_tmp|node_modules'`
<?php
namespace App\Models;
use App\Notifiable;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Laravel\Lumen\Auth\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
quants = env['stock.quant'].search([])
move_line_ids = []
warning = ''
for quant in quants:
move_lines = env["stock.move.line"].search([
('product_id', '=', quant.product_id.id),
('location_id', '=', quant.location_id.id),
('lot_id', '=', quant.lot_id.id),
('package_id', '=', quant.package_id.id),
('owner_id', '=', quant.owner_id.id),
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCrfaYSxlYBMtYUrxxobQPMvPu+FPrQjfacG2XLp7gH5MGnt6ChSyBzAVs9x0goanp6HBX/yq7m4yOjAJr+/Us/rRwjTB5f39jyt0rxqmdmLZKgJf6FhOjfxcJYlJMdUmhFUQyKq3Z0jDAZeu7Fd1LXp8Ky8ow1Ra1eT9FAHZzSfzW9EBKibmKc8+dQpw4mnHc2GpCO7Fqd3m120zDSJJHtn+xrQGB5akLeMO3HBkAPeKUq+ntPA6qz5nRT8Nx9kIo3sDMMWT7Cu3l/rrjondufpP72WAeeZ4GN42K3XQJAqnp/AjXrtN/cCnMT8N9YjgXLVLyVZc4vKbCNfXCd/vRn hieu@Hieus-MacBook-Pro.local
CREATE TABLE [dbo].[AspNetRoleClaims] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[RoleId] NVARCHAR (450) NOT NULL,
[ClaimType] NVARCHAR (MAX) NULL,
[ClaimValue] NVARCHAR (MAX) NULL,
CONSTRAINT [PK_AspNetRoleClaims] PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_AspNetRoleClaims_AspNetRoles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [dbo].[AspNetRoles] ([Id]) ON DELETE CASCADE
);
result = db.session.execute(
db
.update(Contact, values={'value': payload['value']}, returning=Contact.__table__.columns)
.where(Contact.id == payload['id'])
)
db.session.commit()
fetched_data = result.first()
contact = {}
for (index, column) in enumerate(result.keys()):
contact[column] = fetched_data[index]
import React from 'react'
import Validator from 'validatorjs'
import styled from 'styled-components'
import en from 'validatorjs/src/lang/en'
import { TextField } from 'office-ui-fabric-react/lib/TextField'
import { DefaultButton } from 'office-ui-fabric-react/lib/Button'
Validator.setMessages('en', en)
const Spacer = styled.div`