Skip to content

Instantly share code, notes, and snippets.

@ankur0101
ankur0101 / concurrency.py
Created February 20, 2023 06:29
Python concurrency
import time
from multiprocessing import Process, Pipe
def sleeper(seconds, conn):
time.sleep(seconds)
conn.send("Got up after "+str(seconds)+" seconds")
conn.close()
print("Processed: "+str(seconds))
if __name__ == '__main__':
@ankur0101
ankur0101 / validation.js
Created September 23, 2021 06:03
[SAPUI5] UI Validation
debugger;
var softModel = this.getView().getModel('softModel');
var softModelData = softModel.getData();
var selectedRequestID = this.getView().byId('RequestTypeSelect').getSelectedKey();
var i18nBundle = this.getView().getModel('i18n').getResourceBundle();
switch (selectedRequestID) {
case "2":
if (softModel.getProperty("/selectedBankAccount") == "0") {
// return [false, "Please select bank account"];
return [false, i18nBundle.getText("e_type2__bank_account_select")];
from sly import Lexer, Parser
class CalcLexer(Lexer):
tokens = { TYPE_DECLARATION, SPACE, COLLAN, ASSIGN, NAME, TYPEOF, END, LPAREN, RPAREN }
ignore = ' \t'
# Tokens
NAME = r'[a-zA-Z_][a-zA-Z0-9_]*'
# NUMBER = r'\d+'