This file contains 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 alpine:3.16 | |
USER root | |
ENV INITSYSTEM on | |
ENV UDEV=1 | |
ENV DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket | |
ENV BUNDLER_VERSION=2.4.12 | |
ENV NODE_VERSION=14.20.0 | |
ENV YARN_VERSION=1.22.17 |
This file contains 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
community_ids = [247, 14, 1, 13, 8, 4, 7] | |
query = Comment.where( | |
context_type: 'Community', context_id: community_ids | |
).where.not( | |
commentable_id: nil, commentable_type: nil | |
).select(:id, :commentable_id, :commentable_type, :context_id, :context_type) | |
.includes(:commentable, :context) | |
mismatches = query.find_each.with_object([]) do |comment, mismatches| | |
next if comment.commentable.blank? |
This file contains 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
=begin | |
A binary gap within a positive integer N is any maximal sequence of consecutive zeros | |
that is surrounded by ones at both ends in the binary representation of N. | |
Write a function: | |
def solution(n) | |
that, given a positive integer N, returns the length of its longest binary gap. | |
The function should return 0 if N doesn't contain a binary gap. |
This file contains 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
curl -0 -v -XPOST http://localhost:3000/posts.json \ | |
-H "Expect:" \ | |
-H 'Content-Type: application/json; charset=utf-8' \ | |
-d @- << EOF | |
{ | |
"post": { | |
"author_id": "5482696809", | |
"author_name": "@endireitabelem", | |
"body": "Diretas já em cuba .\n#bolsonaro2018 \n#bolsonaropresidente \n#ForaPT \n#ForaComunistas \n@Endireitabelem \nAjude a pagina a crescer, divulgue com seus amigos e familiares vamos juntos Endireitar Belém e o Brasil.", | |
"document_id": "BVADte9Ako7m567891101234", |
This file contains 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
#HTTP error handling | |
@app_context.errorhandler(404) | |
def not_found(error): | |
return render_template('404.html'), 404 |
This file contains 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 flask import Blueprint | |
blueprint = Blueprint('web', __name__, template_folder='templates') | |
from . import routes |
This file contains 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 a module / component using its blueprint handler variable | |
from blueprints.hello import blueprint as hello | |
from blueprints.web import blueprint as web | |
# Register blueprint(s) | |
app_context.register_blueprint(hello, url_prefix='/hello') | |
app_context.register_blueprint(web) |
This file contains 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
@manager.command | |
def list_routes(): | |
import urllib | |
from flask import url_for | |
output = [] | |
for rule in app.url_map.iter_rules(): | |
options = {} | |
for arg in rule.arguments: |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains 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 | |
/* Nomes dos campos ou '*' */ | |
nome,id | |
/* Tabela de destino */ | |
from setor | |
/* Filtro (opcional) */ | |
where id = 3; |
NewerOlder