Skip to content

Instantly share code, notes, and snippets.

Avatar

Adolfo Fitoria fitoria

View GitHub Profile
View cososhares.js
l = document.getElementsByClassName('fwb');
var text = '';
for (i=0; i<l.length; i++){
if (!l[i].children[0])
continue;
if (l[i].children[0].className == 'profileLink')
text += l[i].children[0].text + '(' + l[i].children[0].href + ')\n';
}
console.log(text);
@fitoria
fitoria / ejemplo.py
Created Oct 28, 2015
ejemplo de arrastre con pygame
View ejemplo.py
import pygame
import sys
OLPC_SCREEN_SIZE = (640, 480)
BLANCO = (255, 255, 255)
AZUL = (0, 0, 255)
AMARILLO = (255, 255, 0)
class Main(object):
View gist:b568dc65ae30a3c96e03
<body>
<script type="text/javascript" src="file:///G|/CURSO WEB/DWCS6/div/Maye/jquery-1.11.1.min (1).js"></script>
<script type="text/javascript" src="file:///G|/CURSO WEB/DWCS6/div/Maye/jquery.cycle.all.js"></script>
<script type="text/javascript">
$('#slider').cycle({
fx: 'fade',
speed: 'slow',
next: '#next',
prev: '#prev'
View context.py
#context manager para el menú.
from django.core.cache import cache
from models import Menu
def menu_context_manager(request):
#probamos si esta el elemento en caché
valor = cache.get('menu')
#si no está leemos de la base de datos
if not valor:
@fitoria
fitoria / gist:4496906
Created Jan 9, 2013
configuración básica nginx y pelican
View gist:4496906
server {
#redirigiendo feed
rewrite ^/feed/ /feed.rss.xml permanent;
#redirigiendo about
rewrite ^/about/ /about.html permanent;
#redirigiendo feed de categoria
rewrite ^/category/([a-z-\d-\¿-\¡]+)/feed/ /category/$1.rss.xml permanent;
location / {
#redirigiendo entradas viejas hacia urls nuevas (solo se agrega el .html)
View gist:4496751
Categories: {% for category in article.categories %} <a href="{{ SITEURL }}/{{ category.url }}">{{ category }}</a>, {%endfor%}
View gist:4256917
{%ifequal user.tipo 'profesional'%}
<div class="btn-group user-button">
<button class="btn btn-primary"><i class="icon-user"></i>{{user.get_full_name}}</button>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="{% url mis-notificaciones %}"><i class=""></i> Notificaciones</a></li>
<li><a href="{{user.get_absolute_url}}"><i class=""></i> Ver mi perfil</a></li>
<li><a href="{% url perfil-editar user.perfil.id %}"><i class=""></i> Editar mis datos</a></li>
View gist:3606842
class AfiliacionNacionalCreateView(CreateView):
model = AfiliacionNacional
form_class = AfiliacionNacionalForm
success_url = reverse_lazy('afiliacionnacional-list')
def form_valid(self, form):
messages.info(self.request, 'Afiliacion creado', extra_tags='alert alert-success')
return super(AfiliacionNacionalCreateView, self).form_valid(form)
class AfiliacionNacionalDeleteView(DeleteView):
View gist:2705557
from django.template.defaultfilter import escape
for evento in eventos:
d = {
'id': str(evento.id),
'title': escape(evento.evento),
'start':escape(evento.inicio),
'end':escpe(evento.final),
'allDay': True,
'color':str(evento.user.userprofile.contraparte.font_color)
View felicidades.html
<html>
<head>
<script type="text/javascript">
var felicidades = {message: 'Felicidades', size: 100 };
felicidades.size = felicidades.size / screen.width;
document.write("<h1 style='font-size:" + felicidades.size + " ;'>" + felicidades.message + "</h1>");
</script>
</head>
<body>
</body>
You can’t perform that action at this time.