Skip to content

Instantly share code, notes, and snippets.

View carlosrberto's full-sized avatar
:octocat:

Carlos Roberto Gomes Junior carlosrberto

:octocat:
View GitHub Profile
@carlosrberto
carlosrberto / admin.py
Created May 28, 2011 17:35
testando gist
from django.contrib import admin
from models import *
admin.site.register(Person)
@carlosrberto
carlosrberto / jquery_tests.js
Created May 28, 2011 20:06
jquery selectors tests
function normalizeAccents(s){
// cache para ganho de performance
if ( !! normalizeAccents.cache[s] ) return normalizeAccents.cache[s];
var r=s.toLowerCase();
//r = r.replace(new RegExp("\\s", 'g'),"");
r = r.replace(new RegExp("[àáâãäå]", 'g'),"a");
r = r.replace(new RegExp("æ", 'g'),"ae");
r = r.replace(new RegExp("ç", 'g'),"c");
r = r.replace(new RegExp("[èéêë]", 'g'),"e");
// retorna um range de numeros, ex: range(0, 3) -> [0,1,2,3]
function rangeNumbers(a, b){
var arr = [];
while(a<=b){
arr.push(a);
a++;
}
return arr;
}
@carlosrberto
carlosrberto / secao.html
Created June 22, 2011 20:01
prefeitura
<div id="texto_artigo_wrapper">
<div id="texto_artigo">
<h2 class="titulo_artigo">{{ pagina_atual.titulo }}</h2>
{% if pagina_atual.imagem_principal %}
<div class="box_foto {% if not pagina_atual.alinhamento_imagem %}left{% else %}{{ pagina_atual.alinhamento_imagem }}{% endif %}">
{% if pagina_atual.autor_imagem %}<span class="credito"><span>Foto por:</span> {{ pagina_atual.autor_imagem }}</span>{% endif %}
<a href="#"><img src="{% thumbnail pagina_atual.imagem_principal 334x251 crop,upscale %}" alt="" /></a>
@carlosrberto
carlosrberto / dabblet.css
Created January 10, 2012 15:47
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
@-webkit-keyframes gradientAnimation{
0% { opacity: 0; }
100% { opacity: 1; }
}
body{
@carlosrberto
carlosrberto / header.html
Created January 14, 2012 00:36
jQuery SelectSkin files
<link rel="stylesheet" href="src/jquery.selectskin.css" type="text/css" media="screen">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
<script type="text/javascript" src="src/jquery.selectskin.js"></script>
@carlosrberto
carlosrberto / example.js
Created January 14, 2012 00:38
jQuery SelectSkin call
$(function(){
$('select').SelectSkin();
});
@carlosrberto
carlosrberto / router.js
Created February 17, 2012 15:31
Backbone Routers
var Workspace = Backbone.Router.extend({
routes: {
"help": "help", // #help
"search/:query": "search", // #search/kiwis
"search/:query/p:page": "search" // #search/kiwis/p7
},
help: function() {
...
// Example of how to cache the result of an external jQuery Template.
// Inspired by this post...
// http://encosia.com/2010/10/05/using-external-templates-with-jquery-templates/
var person = {name: 'Dave'};
var person_tmpl;
$.get('_template.tpl.html', function(template) {
// Use converted string from remote file.
@carlosrberto
carlosrberto / svn_revision.py
Created March 1, 2012 13:32
django template revision number
import os
from django import template
from django.utils import version
from settings import PROJECT_PATH
STATIC_PATH = os.path.join(PROJECT_PATH, '../static')
register = template.Library()
@register.simple_tag
def revision_number():