Skip to content

Instantly share code, notes, and snippets.

View SalahAdDin's full-sized avatar
🎯
Focusing

José Luis SalahAdDin

🎯
Focusing
View GitHub Profile
@SalahAdDin
SalahAdDin / gist:4044db11a13c56a977fc
Last active August 29, 2015 14:06
Funciones básicas para enviar mensajes de acuerdo a las noticias.
from django.core.mail import send_mail, mail_admins
from django.db import models
from django.template.defaultfilters import slugify
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from ckeditor.fields import RichTextField
from subtopic.models import Subtopic
@SalahAdDin
SalahAdDin / news.models.py
Created October 20, 2014 19:49
Aquí está el modelo de mi app.
from django.core.mail import send_mail, mail_admins
from django.db import models
from django.template.defaultfilters import slugify
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from ckeditor.fields import RichTextField
from subtopic.models import Subtopic
@SalahAdDin
SalahAdDin / base_search.html
Last active August 29, 2015 14:08
Usando haystack para hacer búsquedas normales y por fechas, y filtrando por tres campos.
<!--Contenido-->
<main>
<div class="row">
<!-- Left Wrapper Seccion listas -->
<div class="show-for-large-up small-1 large-3 columns left-wrapper">
<div class="tabs-content">
{% include 'search/search_menu.html' %}
</div>
</div>
<!--Contenido -->
@SalahAdDin
SalahAdDin / feed.py
Last active August 29, 2015 14:10
News rss file
from django.contrib.syndication.views import Feed
from django.contrib.syndication.views import FeedDoesNotExist
from django.shortcuts import get_object_or_404
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
from .models import New
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.http import HttpResponseForbidden
class MediaRSSFeed(Rss201rev2Feed):
@SalahAdDin
SalahAdDin / settings.py
Last active August 29, 2015 14:10
Configuración para nginx
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "tiempoturco", "statics", "media")
#STATIC_ROOT = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2] + ['statics/static_only'])
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "tiempoturco", "statics", "static_only", )
#STATICFILES_DIRS = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2] + ['statics/static'])
STATICFILES_DIRS = (os.path.join(os.path.dirname(BASE_DIR), "tiempoturco", "statics", "static"),)
@SalahAdDin
SalahAdDin / cepstrum.m
Created December 6, 2014 01:42
Encontrando los coeficientes cepstrales.
function [c] = cepstrum(segs)
%Encontrar los coeficientes cepstrales de cada segmento
[M,N] = size(segs);
% M filas, N columas,
% Definir Mo=output frame size(# de %frecuencias a las que se aplica FFT)
[c] = zeros(M,10);
% Inicialiando el vector para guardar los coeficientes cepstrales.
% P=10
@SalahAdDin
SalahAdDin / FlowMineListener.cpp
Last active August 29, 2015 14:11
Mina de Proximidad para CryEngine
#include "StdAfx.h"
#include "Nodes\G2FlowBaseNode.h"
class CFlowMineListener : public CFlowBaseNode < eNCT_Instanced >, public IEntityEventListener
{
public:
CFlowMineListener(SActivationInfo *pActInfo):
pTargetEnt(nullptr)
{
@SalahAdDin
SalahAdDin / 400.html
Created January 14, 2015 18:05
Wagtail Template Errors
{% extends "error_base.html" %}
{% load i18n %}
{% block titletag %}{% trans 'Client Error' %}{% endblock %}
{% block body_class %}template-400{% endblock %}
{% block content %}
% trans "There's been an error. We have problems with customer requests, ie, of your computer, please check it." %}
{% endblock %}
{% block error %}<span>400</span>{% trans 'error'|capfirst %}{% endblock %}
@SalahAdDin
SalahAdDin / gnmenu1.js
Last active August 29, 2015 14:20
Script for gnmenu: google nexus menú.
/**
* gnmenu.js v1.0.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2013, Codrops
* http://www.codrops.com
*/
@SalahAdDin
SalahAdDin / settings.py
Created May 25, 2015 01:20
Full django-ckeditor configuration.
#CKEditor Options
CKEDITOR_UPLOAD_PATH = "/statics/media/uploads/"
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
CKEDITOR_CONFIGS = {
'default': {
'skin': 'office2013',
'toolbar': [
{ 'name': 'document', 'groups': [ 'mode', 'document', 'doctools' ], 'items': [ 'Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] },