This file contains hidden or 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 | |
| REPO_PATH="/home/ubuntu" | |
| CONF='[gitosis]\ | |
| repositories = /mnt/repositories\ | |
| generate-files-in = /mnt/gitosis\ | |
| gitweb = no\ | |
| daemon = no' | |
| sed -ie "s,\[gitosis\],$CONF," ${REPO_PATH}/gitosis.conf |
This file contains hidden or 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
| gofmt -w . | |
| if [ "$(git diff --diff-filter M --name-only)" == "$(git diff --cached --name-only)" ]; | |
| then | |
| echo "There's gofmt alterations to be commited." | |
| exit 1 | |
| fi |
This file contains hidden or 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
| user = User.objects.create(email="[email protected]") | |
| qs = User.objects.all() | |
| self.assertQuerysetEqual(qs, [repr(user)]) |
This file contains hidden or 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
| a = [] | |
| a[0] = 10 | |
| a[100000] = 10 | |
| puts a.inspect |
This file contains hidden or 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
| kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'` |
This file contains hidden or 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.views.generic import View | |
| from django.utils import simplejson | |
| class JSONResponseView(View): | |
| def render_to_response(self, data, **httpresponse_kwargs): | |
| "Retuns a json response based on the context" | |
| json_data = simplejson.dumps(data) | |
| return HttpResponse(json_data, content_type="application/json", **httpresponse_kwargs) |
This file contains hidden or 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
| find . -name "urls.py" -type f -exec ack -l "paginas" {} \; |
This file contains hidden or 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
| config = { | |
| 'items_per_page': 3, | |
| 'container_id': 'elements' | |
| }; | |
| function Pagination(config, objects) { | |
| this.config = config; | |
| this.objects = objects; | |
| this.current_page = 1; | |
| this.offset = this.config.items_per_page; |
This file contains hidden or 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.test.client import RequestFactory | |
| from django.utils.unittest import TestCase | |
| from myapp.views import my_view | |
| class MyViewTestCase(TestCase): | |
| def test_my_view_should_return_200_status_code(self): | |
| request = RequestFactory().get('url_for_the_view') |
This file contains hidden or 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 unittest import TestCase | |
| from my_app.signals import foo_bar | |
| class SignalsTestCase(TestCase): | |
| def dummy_listener(self, sender, **kwargs): | |
| self.times += 1 | |
| def test_deve_chamar_o_signal_foo_bar(self): |