# get the hashes from the wrong commits with git log
# then revert this commits:
git revert last-commit-hash
# create the correct branch and then checkout to then
git checkout -b right-branch
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
<?php | |
class MinhaClasse { | |
private $data = array(); | |
public function __set($name, $value) { | |
$this->data[$name] = $value; | |
} | |
public function __get($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
def namaTeam(number) | |
return number if (number % 7 != 0 and number % 5 != 0) | |
return "Team" if (number % 7 == 0 and number % 5 != 0) | |
return "Nama" if (number % 7 != 0 and number % 5 == 0) | |
"NamaTeam" | |
end | |
for i in 1..100 | |
puts(namaTeam(i)) | |
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
require "test/unit" | |
require "test/unit/ui/console/testrunner" | |
require "./namateam" | |
class NamaTeamTest < Test::Unit::TestCase | |
def test_multiplos_cinco() | |
assert_equal(namaTeam(5), "Nama") | |
assert_equal(namaTeam(10), "Nama") | |
assert_equal(namaTeam(15), "Nama") | |
assert_equal(namaTeam(55), "Nama") |
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 ClientForm(forms.ModelForm): | |
class Meta: | |
model = Client | |
fields = ('name', 'email') | |
def __init__(self, *args, **kwargs): | |
super(ClientForm, self).__init__(*args, **kwargs) | |
for field in iter(self.fields): | |
self.fields[field].widget.attrs.update({'class': 'form-control'}) |
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
<form method="POST"> | |
{% csrf_token %} | |
{% for field in form %} | |
<div class="form-group"> | |
<label for="id_{{ field.name }}">{{ field.label }}</label> | |
{{ field }} | |
</div> | |
{% endfor %} | |
<button type="submit" class="btn btn-primary">Gravar Cliente</button> | |
</form> |
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 re | |
from django.utils.safestring import mark_safe | |
from django import template | |
register = template.Library() | |
class_re = re.compile(r'(?<=class=["\'])(.*)(?=["\'])') | |
@register.filter | |
def add_class(value, css_class): |
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
{% load add_class %} | |
<form method="post"> | |
{% csrf_token %} | |
{{ form.non_field_errors }} | |
{% for field in form %} | |
<div class="form-group"> | |
{{field.label_tag}} | |
{{field | add_class:"form-control"}} | |
{{field.errors}} | |
</div> |
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
fileIO = BytesIO() | |
boletoPDF = pdf.BoletoPDF(fileIO) | |
boletoPDF.drawBoleto(boleto_dados) | |
boletoPDF.save() | |
fileIO.seek(0) | |
response = HttpResponse(fileIO.read(), content_type='application/pdf') | |
response['Content-Dispositon'] = 'attachment; filename=boleto.pdf' |
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 os | |
import urllib | |
import json | |
from urllib.parse import urlparse | |
from urllib import request | |
""" | |
This script downloads bing's image of the day on the specified folder and set it as wallpaper in xfce4 | |
""" |
OlderNewer