From: karim hamidou Date: Mon, 5 Mar 2012 08:08:02 +0000 (+0100) Subject: changes X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=71aac89dd243808cab03178d1a5f6b8a0c9384df;p=snippets.git changes --- diff --git a/Css/reset.css b/Css/reset.css new file mode 100644 index 0000000..af94440 --- /dev/null +++ b/Css/reset.css @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} \ No newline at end of file diff --git a/Django/render_to.py b/Django/render_to.py new file mode 100644 index 0000000..4365b73 --- /dev/null +++ b/Django/render_to.py @@ -0,0 +1,45 @@ +# -*- mode: python; coding: utf-8; -*- +from django.shortcuts import render_to_response +from django.template import RequestContext + +def render_to(template): + """ + Decorator for Django views that sends returned dict to render_to_response + function with given template and RequestContext as context instance. + + If view doesn't return dict then decorator simply returns output. + Additionally view can return two-tuple, which must contain dict as first + element and string with template name as second. This string will + override template name, given as parameter + + Parameters: + + - template: template name to use + + Examples:: + from sugar.views.decorators import render_to, ajax_request + + @render_to('some/tmpl.html') + def view(request): + if smth: + return {'context': 'dict'} + else: + return {'context': 'dict'}, 'other/tmpl.html' + + (c) 2006-2009 Alexander Solovyov, new BSD License + """ + def renderer(func): + def wrapper(request, *args, **kw): + output = func(request, *args, **kw) + if isinstance(output, (list, tuple)): + return render_to_response(output[1], output[0], + RequestContext(request)) + elif isinstance(output, dict): + return render_to_response(template, output, + RequestContext(request)) + return output + wrapper.__name__ = func.__name__ + wrapper.__module__ = func.__module__ + wrapper.__doc__ = func.__doc__ + return wrapper + return renderer diff --git a/Rake/Rake_sass_watch b/Rake/Rake_sass_watch new file mode 100644 index 0000000..8dfc136 --- /dev/null +++ b/Rake/Rake_sass_watch @@ -0,0 +1,3 @@ +task :watch do + system("sass --watch css/style.scss:css/style.css") +end