Skip to content

Instantly share code, notes, and snippets.

View clint74's full-sized avatar

André Duarte clint74

  • Clint Tecnologia
  • Brazil
View GitHub Profile
@clint74
clint74 / bonfire-dna-pairing.js
Created November 25, 2015 20:41
http://www.freecodecamp.com/clint74 's solution for Bonfire: DNA Pairing Using functional aproach.
// Bonfire: DNA Pairing
// Author: @clint74
// Challenge: http://www.freecodecamp.com/challenges/bonfire-dna-pairing
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function pair(str) {
var get_pair = {"A": "T", "T": "A", "C":"G", "G":"C" };
var map = Array.prototype.map;
var dna_chain = map.call(str, function(elem){
@clint74
clint74 / add_utf8_withBOM.py
Last active March 2, 2016 16:08
this script is used to automate the task of transform cordova plugin files into utf-8 (BOM - byte order mark)
"""
#C:\dev\phonegap\
this script is used to automate the task of transform
cordova plugin files into utf-8 (BOM - byte order mark)
* This is specfic to cordova platform windows
**Windows App Certification Kit complains about encoding of files :-(
and does not allow to public your app on Windows Store until
every file was ok.
"""
import os
#!/bin/sh
#remove migrations files if you are in projectroot/scripts
find .. -path "*/migrations/*.py" -not -name "__init__.py" -delete
find .. -path "*/migrations/*.pyc" -delete
#delete records from migrations table
psql -d mydatabase -c 'delete from django_migrations;'
#create migrations again
@clint74
clint74 / models.py
Last active May 17, 2018 23:53 — forked from djwesleyborges/models.py
Teste
from django.contrib.auth.models import User
from django.db import models
# Model cadastro de produto
class Advertisement(models.Model):
title = models.CharField(max_length=100)
address = models.CharField(max_length=100)
complement = models.CharField(max_length=100)
from django import forms
from advertisement.models import Advertisement, Category
class AdvertisementForm(forms.ModelForm):
class Meta:
model = Advertisement
fields = [
'title',
{% load staticfiles %}
<script type="text/javascript" src="{% static 'js/jquery-3.3.1.slim.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/popper.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.13/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.3.5"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
@clint74
clint74 / cron_django_task_script.py
Created August 29, 2018 16:35
Run cron task in your Django environment
#!/home/andre/.virtualenvs/myproject/bin/python
import os
import sys
DEBUG = False
#DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
<template>
<q-page>
<q-input
float-label="CNPJ/CPF BR"
v-mask="['###.###.###-##', '##.###.###/####-##']"
placeholder="only numbers"
v-model="form.cpfCnpj"
</q-input>
</q-page>
</template>
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login
def login(request):
if request.POST:
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
import platform
import requests
from time import sleep
import os
import sys
from contextlib import contextmanager
from os import mkdir, getcwd
from selenium import webdriver
from PIL import Image
from selenium.webdriver.chrome.options import Options