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 / sass.md
Last active July 14, 2021 18:16
Configurando um ambiente de desenvolvimento com SASS/Compass

Configurando um ambiente com SASS/Compass

Instalação

Atualize o rubygems e instale o Compass, o SASS é instalado automáticamente.

sudo gem update --system
sudo gem install compass
@carlosrberto
carlosrberto / ie_detect.js
Last active December 15, 2015 20:58
A nice way to detect IE version
var ie = (function(){
var undef, v = 3, div = document.createElement('div');
while (
div.innerHTML = '<!--[if gt IE '+(++v)+']><i></i><![endif]-->',
div.getElementsByTagName('i')[0]
);
return v > 4 ? v : undef;
}());
var msie = typeof ie !== "undefined" ? true : false;
@carlosrberto
carlosrberto / ready.js
Created August 31, 2012 18:34
Background Resize
$(function(){
var image = $('.background');
function resize(){
resizeBackground(image, 640, 480);
}
$(window).resize(resize);
});
@carlosrberto
carlosrberto / index.html
Created August 27, 2012 16:58
Basic Template
<!DOCTYPE HTML>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>App</title>
<link rel="stylesheet" href="main.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="main.js"></script>
</head>
<body>
@carlosrberto
carlosrberto / placeholder_fix.js
Created August 24, 2012 18:39
placeholder fix
$(function() {
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
if(!Modernizr.input.placeholder) {
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
@carlosrberto
carlosrberto / .gitignore
Created July 30, 2012 13:37
Git Ignore Template
# folders
app/media/uploads
static/site/css
.sass-cache
CACHE
.DS_Store
.svn
# extensions
*.pyc
@carlosrberto
carlosrberto / gist:3173843
Created July 25, 2012 01:28
Fabric autocomplete
_fab()
{
local cur
COMPREPLY=()
# Variable to hold the current word
cur="${COMP_WORDS[COMP_CWORD]}"
# Build a list of the available tasks using the command 'fab -l'
local tags=$(fab -l 2>/dev/null | grep "^ " | awk '{print $1;}')
@carlosrberto
carlosrberto / fabfile.py
Created July 24, 2012 11:30
Fabfile exemplo
# coding: utf-8
import os
from fabric.api import run, env, local
# local
env.local_root = os.path.abspath( os.path.dirname(__file__) )
# remote
env.hosts = [
'[email protected]',
@carlosrberto
carlosrberto / mimetype.py
Created April 12, 2012 17:45
django request.is_ajax() workaround for IE
def response_mimetype(request):
tridentEngine = 'Trident' in request.META['HTTP_USER_AGENT'] or 'MSIE' in request.META['HTTP_USER_AGENT']
if tridentEngine:
return 'text/html'
else:
return 'application/json'
from django.conf import settings
from django.contrib import admin
from django.utils.safestring import mark_safe
from django.utils.text import capfirst
site = admin.site
def applist(request):
app_dict = {}
user = request.user