Skip to content

Instantly share code, notes, and snippets.

View ionatan-israel's full-sized avatar
🏠
Working from home

Jonatan Rodríguez ionatan-israel

🏠
Working from home
View GitHub Profile

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
# coding=utf-8
import hashlib
from django import forms
from .khipu_settings import USER_ID, USER_KEY
class KhipuPaymentForm(forms.Form):
server { listen 80;
server_name example.com;
access_log /var/log/example.com/nginx.access.log;
error_log /var/log/example.com/nginx.error.log;
root /var/www/apps/example.com/public;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {

Create this file in your graphite installation directory: lib/python2.7/site-packages/graphite/crossmiddleware.py

import re
 
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
 
from django import http
@ionatan-israel
ionatan-israel / dynamic-formset.js
Last active August 29, 2015 14:26 — forked from jteso/dynamic-formset.js
Dynamically adding forms to a formset with jQuery in Django
function updateElementIndex(el, prefix, ndx) {
var id_regex = new RegExp('(' + prefix + '-\\d+)');
var replacement = prefix + '-' + ndx;
if ($(el).attr("for")) $(el).attr("for", $(el).attr("for").replace(id_regex, replacement));
if (el.id) el.id = el.id.replace(id_regex, replacement);
if (el.name) el.name = el.name.replace(id_regex, replacement);
}
function addForm(btn, prefix) {
var formCount = parseInt($('#id_' + prefix + '-TOTAL_FORMS').val());
@ionatan-israel
ionatan-israel / rounding_decimals.md
Last active August 29, 2015 14:26 — forked from jackiekazil/rounding_decimals.md
How do I round to 2 decimals in python?

How do I round to 2 decimals?

In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.

All the examples use demical types, except for the original value, which is automatically casted as a float.

To set the context of what we are working with, let's start with an original value.

Original Value

@ionatan-israel
ionatan-israel / atom packages
Last active September 8, 2015 17:46 — forked from focusaurus/atom packages
Atom text editor setup 2015-01-12
atom-beautify
atom-color-highlight
autoclose-html
autocomplete-plus
git-blame
git-plus
jsdoc
jsformat
language-docker
language-dockerfile
@ionatan-israel
ionatan-israel / osx-homebrew-setup.md
Created October 7, 2015 07:59 — forked from sr75/osx-homebrew-setup.md
Mac Yosemite OSX - Homebrew (RVM/MySQL/Redis) setup

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

@ionatan-israel
ionatan-israel / gitflow-breakdown.md
Created April 30, 2016 01:20 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository