Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

José Luis SalahAdDin

🎯
Focusing
View GitHub Profile
@SalahAdDin
SalahAdDin / gist:4044db11a13c56a977fc
Last active Aug 29, 2015
Funciones básicas para enviar mensajes de acuerdo a las noticias.
View gist:4044db11a13c56a977fc
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 Oct 20, 2014
Aquí está el modelo de mi app.
View news.models.py
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 Aug 29, 2015
Usando haystack para hacer búsquedas normales y por fechas, y filtrando por tres campos.
View base_search.html
<!--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 Aug 29, 2015
News rss file
View feed.py
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 Aug 29, 2015
Configuración para nginx
View settings.py
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 Dec 6, 2014
Encontrando los coeficientes cepstrales.
View cepstrum.m
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 Aug 29, 2015
Mina de Proximidad para CryEngine
View FlowMineListener.cpp
#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 Jan 14, 2015
Wagtail Template Errors
View 400.html
{% 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 Aug 29, 2015
Script for gnmenu: google nexus menú.
View gnmenu1.js
/**
* 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
Full django-ckeditor configuration.
View settings.py
#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' ] },