Skip to content

Instantly share code, notes, and snippets.

View dennis90's full-sized avatar
🚶‍♂️

Dennis Alves dennis90

🚶‍♂️
View GitHub Profile
@dennis90
dennis90 / index.js
Created April 1, 2023 16:00
exercicio
const SQUARE_WIDTH = 9;
const HEIGHT = 9;
const SPACING = 5;
const DRAW_CHAR = "*";
function drawSquare(line) {
let square = "";
for (let row = 0; row < SQUARE_WIDTH; row++) {
if (line === 0 || line === HEIGHT - 1) {
square += DRAW_CHAR;
@dennis90
dennis90 / general.code-snippets.json
Created November 5, 2020 20:34
My VSCODE Snippets
{
"Generic editorconfig": {
"scope": "editorconfig",
"prefix": "cfg",
"body": [
"root = true",
"",
"[*]",
"indent_style = space",
"indent_size = 2",
@dennis90
dennis90 / README.md
Last active September 27, 2020 04:31
Minimal Webpack / React project

Minimal Webpack project with React.js

This is a minimal config for React.js that allows code spliting, hot reloading dev server and build capabilities.

Project structure

src/index.html
src/main.js
.babelrc
package.json
#!/usr/bin/env bash
# ----------------------------- VARIÁVEIS ----------------------------- #
URL_GOOGLE_CHROME="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
URL_SIMPLE_NOTE="https://github.com/Automattic/simplenote-electron/releases/download/v1.8.0/Simplenote-linux-1.8.0-amd64.deb"
URL_VSCODE="https://go.microsoft.com/fwlink/?LinkID=760868"
URL_SLACK="https://downloads.slack-edge.com/linux_releases/slack-desktop-4.1.2-amd64.deb"
URL_FIRECODE_FONT="https://github-production-release-asset-2e65be.s3.amazonaws.com/26500787/4cb9e980-d344-11e9-91cc-18f9a761c960?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191022%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191022T165626Z&X-Amz-Expires=300&X-Amz-Signature=0ad748fe86e03afedf84b1738e984d71929e59d711dddec24efdc7aeac1183fb&X-Amz-SignedHeaders=host&actor_id=1143232&response-content-disposition=attachment%3B%20filename%3DFiraCode_2.zip&response-content-type=application%2Foctet-stream"
URL_VSCODE_SETTINGS="https:
{
"editor.fontFamily":"Fira Code",
"editor.fontLigatures": false,
"editor.fontSize":16,
"editor.lineHeight":24,
"editor.parameterHints.enabled": false,
"editor.renderLineHighlight": "gutter",
"editor.renderWhitespace": "boundary",
"editor.rulers": [120],
"editor.tabCompletion": "off",
## Just run the following line
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@dennis90
dennis90 / git_pushed_wrong_branch.md
Created October 8, 2017 18:56
What to do when you push to the wrong branch

Oh shit, I accidentally pushed to the wrong branch

# get the hashes from the wrong commits with git log

# then revert this commits:
git revert last-commit-hash

# create the correct branch and then checkout to then
git checkout -b right-branch
@dennis90
dennis90 / set_wallpaper.py
Created August 7, 2017 16:04
Download wallpaper of the day at bing and set as wallpaper in xfce4
import os
import urllib
import json
from urllib.parse import urlparse
from urllib import request
"""
This script downloads bing's image of the day on the specified folder and set it as wallpaper in xfce4
"""
fileIO = BytesIO()
boletoPDF = pdf.BoletoPDF(fileIO)
boletoPDF.drawBoleto(boleto_dados)
boletoPDF.save()
fileIO.seek(0)
response = HttpResponse(fileIO.read(), content_type='application/pdf')
response['Content-Dispositon'] = 'attachment; filename=boleto.pdf'
{% load add_class %}
<form method="post">
{% csrf_token %}
{{ form.non_field_errors }}
{% for field in form %}
<div class="form-group">
{{field.label_tag}}
{{field | add_class:"form-control"}}
{{field.errors}}
</div>