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
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
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
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
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
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
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
#!/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
#!/bin/bash | |
sudo apt-get update | |
sudo apt-get -y install make libmysqlclient-dev x11-apps | |
wget http://www.rsyslog.com/files/download/rsyslog/rsyslog-4.6.1.tar.gz | |
tar xvf rsyslog-4.6.1.tar.gz | |
cd rsyslog-4.6.1 | |
sudo mkdir /var/log/rsyslog # replace by your $WorkDirectory value, if any |
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
package main | |
import ( | |
"fmt" | |
"launchpad.net/goamz/aws" | |
"launchpad.net/goamz/ec2" | |
) | |
var auth aws.Auth | |
var region aws.Region |