Skip to content

Instantly share code, notes, and snippets.

View jfunez's full-sized avatar

Juan Funez jfunez

  • iib-institut.de
  • Berlin, Germany
View GitHub Profile

#MongoDB - Setting up a Replica Set

cd \mongodbdir\

mkdir db1
mkdir db2
mkdir db3

###Primary mongod --dbpath ./db1 --port 30000 --replSet "demo"

@jfunez
jfunez / ddg_dev_01.py
Created January 23, 2017 01:01
primeira reunião DdG devs
# esto 'e um coment'ario numa linha s'o
"""
isto e um
comentario
en varias linhas
"""
esta_e_uma_variavel = 'Juan' # define uma variável, uma string
@jfunez
jfunez / input_spinner.css
Created May 1, 2016 04:25
input type number spinner icons - display always (firefox & chrome)
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
opacity: 1;
}
input[type="number"] {
-moz-appearance: textfield-multiline;
-webkit-appearance: textfield;
}
@jfunez
jfunez / modal.fix.js
Created April 9, 2016 18:06
remove modal content to avoid caching
$(function () {
$('#modal-id').on('shown', function () {
/* add code here to be executed when modal is displayed */
});
$('#modal-id').on('hidden', function () {
/* the next line will remove from DOM the content of the modal body */
$(this).removeData('modal');
});
});
@jfunez
jfunez / test_login_selenium.py
Created March 4, 2016 13:39
example of login with selenium
# pip install selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://127.0.0.1:5000/admin/login/")
driver.maximize_window()
input_login = driver.find_element_by_id('email')
@jfunez
jfunez / gen_secret_key.py
Created February 24, 2016 15:06
gerar secret key
import os
import binascii
binascii.hexlify(os.urandom(24))
@jfunez
jfunez / 0_reuse_code.js
Created February 11, 2016 12:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jfunez
jfunez / setup.py
Created December 1, 2015 18:01 — forked from rochacbruno/Makefile
Perfect setup.py
import pip
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
links = [] # for repo urls (dependency_links)
requires = [] # for package names
@jfunez
jfunez / loggers_settings.py
Created June 10, 2014 13:47
django_loggers_settings
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
},
},
'handlers': {
'default': {
from os.path import splitext
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import filesizeformat
class FileValidator(object):
"""
Validator for files, checking the size, extension and mimetype.