⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urlparse | |
import re | |
from django.db import models | |
from django import forms | |
def validate_youtube_url(value): | |
'''El patron lo saque de http://stackoverflow.com/questions/2964678/jquery-youtube-url-validation-with-regex''' | |
pattern = r'^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=\w+)(?:\S+)?$' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.html import mark_safe | |
from django.forms.widgets import RadioSelect | |
class HorizRadioRenderer(RadioSelect.renderer): | |
""" this overrides widget method to put radio buttons horizontally | |
instead of vertically. | |
""" | |
def render(self): | |
"""Outputs radios""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Vim < Formula | |
homepage 'http://www.vim.org/' | |
url 'https://vim.googlecode.com/hg/', :revision => '6c318419e331' | |
version '7.3.515' | |
def features; %w(tiny small normal big huge) end | |
def interp; %w(lua mzscheme perl python python3 tcl ruby) end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
block goods { | |
tag: 'ul' | |
content: { | |
var content = []; | |
this.ctx.goods.forEach(function(item){ | |
var mods = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install Redis | |
echo 'Install Redis' | |
cd /tmp | |
mkdir redis && cd redis | |
wget http://download.redis.io/redis-stable.tar.gz | |
tar xvzf redis-stable.tar.gz | |
cd redis-stable | |
make && make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To use this recipe you have to: | |
# $ brew install python --framework | |
# $ mkdir ~/Frameworks | |
# $ ln -s "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework" ~/Frameworks | |
# $ brew install ./vim.rb | |
require 'formula' | |
require 'open-uri' | |
class Vim < Formula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Scrol to elem | |
* @param {String} selector [description] | |
* @param {Function} callback [description] | |
*/ | |
function scrollToElement(selector, callback){ | |
var animation = {scrollTop: $(selector).offset().top}; | |
console.log(selector); | |
$('html,body').animate(animation, 'slow', 'swing', function() { | |
if (typeof callback == 'function') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from fabric.api import task | |
from fabric.api import run | |
from fabric.api import local | |
from fabric.api import env | |
from fabric.api import cd | |
from fabric.api import prefix | |
from fabric.api import hide | |
# Расположение зависимостей для проекта |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NoCacheMiddleware(object): | |
def process_response(self, request, response): | |
response['Pragma'] = 'no-cache' | |
response['Cache-Control'] = 'private, max-age=0, proxy-revalidate, no-store, no-cache, must-revalidate' | |
return response |