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
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class MessageForm(forms.Form):
text_input = forms.CharField()
/*!
* Bootstrap v2.2.1
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
#!/usr/bin/env bash
if [ $EUID != 0 ]; then
"This script must be run with sudo"
exit $?
fi
echo " Installing dependencies"
apt-get install ia32-libs -y # Note: This dep is a bit overkill but it's useful anyway
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
// JavaScript Document
// Función para recoger los datos de PHP según el navegador, se usa siempre.
function objetoAjax(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {

This is my take on how to get up and running with NGINX, PHP-FPM, MySQL and phpMyAdmin on OSX Yosemite.

This article is adapted from the original by Jonas Friedmann. Who I just discovered is from Würzburg in Germany. A stonesthrow from where I was born ;)

Xcode

Make sure you have the latest version of XCode installed. Available from the Mac App Store.

Install the Xcode Command Line Tools:

xcode-select --install

# views.py
from django.views.generic import RedirectView
from django.core.urlresolvers import reverse
class NamedUrlRedirectView(RedirectView):
def __init__(self, url, *args, **kwargs):
self.url = reverse(url)
super(NamedUrlRedirectView, self).__init__(*args, **kwargs)
"""
Example of mandrill service in python (http://mandrill.com/)
Description of usage in python:
Russian: http://www.lexev.org/2014/send-email-django-project-mandrill-service/
English: http://www.lexev.org/en/2014/send-email-django-project-mandrill-service/
"""
# ======
# Django
/**
* setup JQuery's AJAX methods to setup CSRF token in the request before sending it off.
* http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request
*/
function getCookie(name)
{
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
@ionatan-israel
ionatan-israel / page.py
Last active August 29, 2015 14:17 — forked from rturowicz/page.py
# admin.py: admin action definition
def make_copy(self, request, queryset):
form = None
if 'apply' in request.POST:
form = CopyPageForm(request.POST)
if form.is_valid():
issue = form.cleaned_data['issue']