Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Carlos Equiz crustafari

🎯
Focusing
Block or report user

Report or block crustafari

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@crustafari
crustafari / bobp-python.md
Created Sep 10, 2019 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.
View bobp-python.md

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
View list-dictionaries-group-by-key.py
import itertools
from operator import itemgetter
sorted_animals = sorted(animals, key=itemgetter('size'))
animals = [{'name':'cow', 'size':'large'},{'name':'bird', 'size':'small'},{'name':'fish', 'size':'small'},{'name':'rabbit', 'size':'medium'},{'name':'pony', 'size':'large'},{'name':'squirrel', 'size':'medium'},{'name':'fox', 'size':'medium'}]
for key, group in itertools.groupby(sorted_animals, key=lambda x:x['size']):
print key,
print list(group)
@crustafari
crustafari / python-cheat-sheet.py
Last active Mar 16, 2020
Personal Python Cheat Sheet
View python-cheat-sheet.py
# Getting class name
MyClass(x).__name__
# UTC timestamp 2020-03-04T17:50:26.376Z
now = datetime.datetime.utcnow()
timestamp = now.strftime('%Y-%m-%dT%H:%M:%S') + \
'.%03d' % (now.microsecond / 1000) + 'Z'
# Jupyter arguments
@crustafari
crustafari / intro-functional-programming.js
Created Apr 29, 2019
A Functional Programmer’s Introduction to JavaScript from Eric Elliot's Composing Software
View intro-functional-programming.js
// EXPRESSIONS AND VALUES
// A variable declared with the const keyword can’t be reassigned. This restriction is a good thing.
const hola = 'Hola';
// TYPES
const arreglo = [1, 2, 3];
const a = 'a';
const b = 'b';
View AccountType.php
<?php
namespace NoxLogic\DemoBundle\Form\Type;
use Doctrine\ORM\EntityManager;
use NoxLogic\DemoBundle\Entity\Province;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
You can’t perform that action at this time.