List of all unicode’s open/close brackets?

There is a plain-text database of information about every Unicode character available from the Unicode Consortium; the format is described in Unicode Annex #44. The primary information is contained in UnicodeData.txt. Open and close punctuation characters are denoted with Ps (punctuation start) and Pe (punctuation end) in the General_Category field (the third field, delimited by … Read more

Advanced JavaScript: Why is this function wrapped in parentheses? [duplicate]

There are a few things going on here. First is the immediately invoked function expression (IIFE) pattern: (function() { // Some code })(); This provides a way to execute some JavaScript code in its own scope. It’s usually used so that any variables created within the function won’t affect the global scope. You could use … Read more

“assert” statement with or without parentheses

The last assert would have given you a warning (SyntaxWarning: assertion is always true, perhaps remove parentheses?) if you ran it through a full interpreter, not through IDLE. Because assert is a keyword and not a function, you are actually passing in a tuple as the first argument and leaving off the second argument. Recall … Read more

How to create decorators with parameters in Python?

The syntax for decorators with arguments is a bit different – the decorator with arguments should return a function that will take a function and return another function. So it should really return a normal decorator. A bit confusing, right? What I mean is: def decorator_factory(argument): def decorator(function): def wrapper(*args, **kwargs): funny_stuff() something_with_argument(argument) result = … Read more

How to select between brackets (or quotes or …) in Vim?

To select between the single quotes I usually do a vi’ (“select inner single quotes”). Inside a parenthesis block, I use vib (“select inner block”) Inside a curly braces block you can use viB (“capital B”) To make the selections “inclusive” (select also the quotes, parenthesis or braces) you can use a instead of i. … Read more

Complex Git branch name broke all Git commands

Problem Can anyone explain what happened? […] I’d love to be able to delete that branch, but Git won’t work for me. By running git branch SSLOC-201_Implement___str__()_of_ProductSearchQuery in zsh, you did not create any branch. Instead, you accidentally defined three shell functions, called git, branch, and SSLOC-201_Implement___str__, which ignore their parameters (if any) and whose … Read more

What is the formal difference in Scala between braces and parentheses, and when should they be used?

I tried once to write about this, but I gave up in the end, as the rules are somewhat diffuse. Basically, you’ll have to get the hang of it. Perhaps it is best to concentrate on where curly braces and parenthesis can be used interchangeably: when passing parameters to method calls. You may replace parenthesis … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)