Skip to content

Instantly share code, notes, and snippets.

View marcelor's full-sized avatar

Marcelo Ramos marcelor

View GitHub Profile
@marcelor
marcelor / gist:138d14aeb5a5d6f0ec2eae9f8015255b
Last active May 7, 2016 18:52
Run "git status" when there is a change in the current folder.
1. $ brew install fswatch
2. Create script gitstatus.sh:
#!/bin/bash
clear
fswatch -e ".lock" -r . | xargs -I {} sh -c 'clear; git status -s'
3. Run gitstatus.sh inside your repo's root folder.
import importlib
def class_for_name(module_name, class_name):
# load the module, will raise ImportError if module cannot be loaded
m = importlib.import_module(module_name)
# get the class, will raise AttributeError if class cannot be found
c = getattr(m, class_name)
return c
@marcelor
marcelor / update_contenttypes_names_signal.py
Last active December 28, 2015 09:29
Signal to update the column name in the Django's content types table when the verbose_name of a model is added, modified or deleted. Original code: http://stackoverflow.com/questions/6847020/when-verbose-name-changes-how-do-i-auto-update-a-models-contenttype
from django.contrib.contenttypes.models import ContentType
from django.utils.functional import Promise
from south.signals import post_migrate
def update_contenttypes_names(**kwargs):
for c in ContentType.objects.all():
cl = c.model_class()
if cl:
new_name = cl._meta.verbose_name
if c.name != new_name:
from apps.polidata.models import Politician
twitter_data = {
"00512": "@PepeSolari",
"00405": "@JAIMETROBO",
"05851": "@AlfredoAsti",
"00161": "@JuanRaFerreira",
"05262": "@dpayss1",
"05137": "@juliocesilveira",
"00197": "@Luisaheber",
@marcelor
marcelor / gist:4242760
Created December 9, 2012 00:38
11 Big Tech Trends You'll See in 2013
1. Second-Screen Revolution
2. Big Data
3. End of Anonymous Trolls
4. End of Privacy
5. Rise of Reporting
6. Official Death of Desktops
7. 3D Printing
8. Flexible Devices
9. Embedded Technology
10. Crowdfunding Mania