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 -*- | |
''' | |
This module represents the recommender system for recommending | |
new friends based on 'mutual friends'. | |
''' | |
__author__ = 'Marcel Caraciolo <[email protected]>' |
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
# Compress Files | |
tar -zcvf foo.tar.gz /home/douglas/foo | |
# Extract files | |
tar -zxvf foo.tar.gz |
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
String.prototype.title_case = function () { | |
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); | |
}; | |
r = ''; | |
$('#IdModelo option').each(function(){ | |
r += 'u\''+$(this).text().title_case()+'\', '; | |
}); | |
console.log(r); |
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
~$ cd /opt/VirtualBox | |
~$ ls -al | |
~$ sudo chmod +x uninstall.sh | |
~$ sudo sh uninstall.sh | |
# then with 'cd' command move to the directory where is the .deb file, and execute it, example: | |
~$ cd ~/Downloads | |
~$ sudo dpkg -i virtualbox-4.1_4.1.20-80170~Ubuntu~precise_amd64.deb |
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
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, "find this string", "replace found string with this string"); |
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
<!-- http://coderwall.com/p/p0nvjw?i=5&p=1&q= --> | |
<ol class="breadcrumb"> | |
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> | |
<a href="http://www.example.com/" itemprop="url"> | |
<span itemprop="title">Example.com</span> | |
</a> | |
</li> | |
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> | |
<a href="http://www.example.com/news" itemprop="url"> | |
<span itemprop="title">News</span> |
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
# https://groups.google.com/forum/?fromgroups#!topic/django-brasil/TZBXSowifn8 | |
from django.utils.encoding import smart_str, smart_unicode | |
a = u'\xa1' | |
print smart_str(a) |
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
# Apply keyword searches. | |
def construct_search(field_name): | |
if field_name.startswith('^'): | |
return "%s__istartswith" % field_name[1:] | |
elif field_name.startswith('='): | |
return "%s__iexact" % field_name[1:] | |
elif field_name.startswith('@'): | |
return "%s__search" % field_name[1:] | |
else: | |
return "%s__icontains" % field_name |
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
# https://groups.google.com/forum/?fromgroups#!topic/django-brasil/d6gV1V9qrgU | |
from django.forms import ModelForm | |
from minha_app.models import MeuModel | |
class MeuForm(ModelForm): | |
class Meta: | |
model = MeuModel |
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
SetEnvIf Origin "^http(s)?://(.+\.)?(http://ANY_DOMAIN_HERE\.com)$" origin_is=$0 | |
Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is |