Skip to content

Instantly share code, notes, and snippets.

View dalmarcogd's full-sized avatar
🔪
coding

Guilherme Dalmarco dalmarcogd

🔪
coding
View GitHub Profile
@dalmarcogd
dalmarcogd / SCSS.md
Created May 13, 2018 21:11 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@dalmarcogd
dalmarcogd / settings.py
Created March 22, 2018 11:45 — forked from lucasrcezimbra/settings.py
Django init settings.py with dj-database-url and python-decouple
"""
Django settings for subscriptions project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
@dalmarcogd
dalmarcogd / bobp-python.md
Created March 20, 2018 16:41 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@dalmarcogd
dalmarcogd / validate_credit_card.js
Created March 19, 2018 12:17 — forked from DiegoSalazar/validate_credit_card.js
Luhn algorithm in Javascript. Check valid credit card numbers
// takes the form field value and returns true on valid number
function valid_credit_card(value) {
// accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
var nCheck = 0, nDigit = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
@dalmarcogd
dalmarcogd / git-bash.exe-args
Created February 15, 2018 15:15 — forked from kujiy/git-bash.exe-args
How to open a specific folder with git-bash.exe from a command line(shell)
With argument
"C:\Program Files\Git\git-bash.exe" "--cd=%1"
Direct
"C:\Program Files\Git\git-bash.exe" "--cd="C:\YOUR\FOLDER\"
@dalmarcogd
dalmarcogd / base64_mixin_field.py
Last active September 11, 2022 11:16
Upload file in python with base64 and json.
import base64
import binascii
import uuid
from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from rest_framework.fields import (
DateField,
@dalmarcogd
dalmarcogd / uploadFile.directive.js
Last active February 1, 2018 19:31
Upload de arquivos em angularjs e bootstrap.
var moduleName = 'uploadfile'
angular.module(moduleName, [])
.controller('UploadController', ['$scope', '$http', 'UploadFileService', function ($scope) {
$scope.$watch('file', function (newfile, oldfile) {
if (angular.equals(newfile, oldfile)) {
return;
}
// UploadFileService.upload(newfile).then(function (res) {