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
- hosts: localhost | |
gather_facts: no | |
vars: | |
my_var: "en,nl" | |
tasks: | |
- debug: | |
msg: | | |
{% for lang in my_var.split(',') %} | |
Language: {{ lang }} | |
{% endfor %} |
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
#!/bin/bash | |
ansible localhost -m debug -a 'msg={{ "en,nl".split(",") }}' |
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
from jinja2 import Template | |
template = Template(""" | |
{% for lang in my_var.split(',') %} | |
Language: {{ lang }} | |
{% endfor %} | |
""") | |
output = template.render(my_var="en,nl") | |
print(output) |
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
public class FullSearchQueryParser { | |
//SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; | |
private static final List<String> stopWords = List.of( | |
"a", "about", "an", "are", | |
"as", "at", "be", "by", | |
"com", "de", "en", "for", | |
"from", "how", "i", "in", | |
"is", "it", "la", "of", | |
"on", "or", "that", "the", |
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 formPost = (fields, path) => { | |
const form = document.createElement("form"); | |
form.method = "POST"; | |
form.action = path; | |
Object.entries(fields).forEach(field => { | |
const hiddenField = document.createElement("input"); | |
hiddenField.type = "hidden"; | |
hiddenField.name = field[0]; | |
hiddenField.value = field[1]; | |
form.appendChild(hiddenField); |
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
colima start | |
docker run --detach --name some-mariadb --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:latest | |
docker exec -it some-mariadb bash | |
mariadb | |
CREATE DATABASE test; | |
USE test; | |
CREATE TABLE users( | |
id int NOT NULL AUTO_INCREMENT, | |
name varchar(100), |
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
public class BaseException extends RuntimeException { | |
public BaseException(String message) { | |
super(message); | |
} | |
protected boolean suppressStackTrace() { | |
return 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
const mailRegExp = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.?[a-zA-Z]*$/; | |
mailRegExp.test("a@a") | |
// true | |
mailRegExp.test("a!@a") | |
// false | |
mailRegExp.test("a!@a/x") | |
// false | |
mailRegExp.test("[email protected]") | |
// true |
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 range = (start, end, includeEnd=false) => Array.from({ length: end - start + (includeEnd ? 1 : 0) }, (_, i) => i + start); |
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
select s.id, t.* | |
from service_groups s | |
join ( | |
select short_name, service_id, count(*) as qty | |
from service_groups | |
group by short_name, service_id | |
having count(*) > 1 | |
) t on s.short_name = t.short_name and s.service_id = t.service_id; |
NewerOlder