This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
# from constraint import * | |
# | |
# problem = Problem() | |
# | |
# problem.addVariable("Q400 Eco", [80, 0, 0]) | |
# problem.addVariable("Q400 Aff", [0, 44, 0]) | |
# problem.addVariable("Q400 First", [0, 0, 19]) | |
# problem.addVariable("ORY", [368, 107, 19, 4.25]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table task_tb | |
( | |
id serial not null | |
constraint task_tb_pkey | |
primary key, | |
type varchar(110), | |
arguments varchar(2000), | |
created_at timestamp, | |
constraint unique_task | |
unique (type, arguments) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Task(db.Model): | |
__tablename__ = 'task_tb' | |
id = db.Column(db.Integer, primary_key=True) | |
type = db.Column(db.String(SLen.NAME)) | |
arguments = db.Column(db.String(2000)) | |
created_at = db.Column(db.DateTime, default=func.now()) | |
__table_args__ = (UniqueConstraint('type', 'arguments', name='unique_task'),) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapper = { | |
'function1': function1, | |
'function2': function2 | |
} | |
def execute_pending_tasks(): | |
all_pending_tasks = Task.query.all() | |
for t in all_pending_tasks: | |
try: | |
associated_function = mapper.get(t.type, False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t = Task(type='resize', arguments=json.dumps({'new_width': width, 'url': url, 'bucket': self.bucket})) | |
try: | |
db.session.add(t) | |
db.session.commit() | |
sys_log.info("Added the resize task to the DB") | |
except IntegrityError as integrityerror: | |
db.session.rollback() | |
sys_log.info("Task is conflicting with another task in the DB") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste that in Google console | |
$$('#meb-items-cnt > section.active-page__list > div > div > div > div > div.col-3 > div.me-item-activity > div:nth-child(1) > span.me-item-activity__column-count').reduce((a, c)=>a+parseInt(c.innerHTML), 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const name = $("#buyercontactname").val(); | |
const address1 = $('#buyeraddress1').val(); | |
const address2 = $('#buyeraddress2').val(); | |
const zip = $('#buyerzip').val(); | |
const city = $('#buyercity').val(); | |
const country = $('#buyercountry').children("option:selected").attr('id'); | |
let big_table = $('#ERSShipnHand').find("table"); | |
let all_articles = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<form id="form"> | |
<input type="number" id="rnr" placeholder="Rechnungsnummer" style="margin-bottom: 10px"> | |
<input type="submit" value="Rechnung Erstellen"> | |
</form> | |
<script type="text/javascript" src="popup.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// var app = chrome.runtime.getBackgroundPage(); | |
document.addEventListener('DOMContentLoaded', function () { | |
debugger; | |
console.log("the doc loaded") | |
var form = document.getElementById("form") | |
console.log(form) | |
form.addEventListener('submit', function (e) { | |
e.preventDefault() | |
console.log("added to the form") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Number.prototype.pad = function (size) { | |
var s = String(this); | |
while (s.length < (size || 2)) { | |
s = "0" + s; | |
} | |
return s; | |
} | |
function run() { | |
chrome.storage.sync.get(['name', 'address1', 'address2', 'zip', 'city', 'country', 'articles', 'buyDateString', 'payDateString', 'rnr', 'shipping', 'invoiceFileDate'], (result) => { |