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
function getSortedIndexes(table) { | |
var indexes = []; | |
for (var i = 0; i < table.headers.length; i += 1) { | |
indexes.push(i); | |
} | |
return indexes.sort((function (t) { | |
return function (a, b) { |
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
var prototype1 = { | |
"version": "0.1", | |
"return": "result", | |
"steps": [{ | |
"for_each": { | |
"items": "std", // FIXME | |
"for_each_item": [{ | |
"classify": { | |
"module_id": "cl_8naYeRdA", | |
"text": "item", |
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 __future__ import print_function | |
import sys | |
import os | |
from os.path import join, abspath | |
import shutil | |
sourcedir = abspath(sys.argv[1]) |
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 MultiSerializerViewSetMixin(object): | |
def get_serializer_class(self): | |
""" | |
Look for serializer class in self.serializer_action_classes, which | |
should be a dict mapping action name (key) to serializer class (value), | |
i.e.: | |
class MyViewSet(ViewSet): | |
serializer_class = MyDefaultSerializer | |
serializer_action_classes = { |
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/sh | |
set -e | |
if [ ! -f /usr/local/bin/ansible-playbook ] | |
then | |
sudo apt-get update | |
sudo apt-get -y install python-setuptools python-dev | |
sudo easy_install pip | |
sudo pip install ansible | |
fi | |
ansible-playbook /vagrant/provisioning/vagrant.yml -i /vagrant/provisioning/development --connection=local |
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 split_every(n, iterable): | |
i = iter(iterable) | |
piece = list(islice(i, n)) | |
while piece: | |
yield piece | |
piece = list(islice(i, n)) |
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
""" | |
In django PUT and DELETE request doesn't get from params parsed in django, IMO | |
they should be handled exaclty like a POST request and end up in request.POST | |
(yes I know it's a bad name...). | |
request.GET stores query/url params and request.POST form/body params. | |
""" | |
from django.http import QueryDict |
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 twisted.internet import reactor | |
from scrapy.crawler import Crawler | |
from scrapy.settings import CrawlerSettings | |
from scrapy import log as scrapy_log, signals | |
def _start_crawling(spider, log_level='INFO'): | |
crawler = Crawler(CrawlerSettings(settings)) | |
crawler.configure() | |
crawler.crawl(spider) |
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
- name: Update default locale to 'en_US.utf8' | |
command: update-locale LC_ALL="en_US.utf8" | |
sudo: True | |
- name: Install db packages | |
apt: pkg=$item state=installed | |
with_items: | |
- postgresql-9.1 | |
- postgresql-contrib-9.1 | |
- postgresql-server-dev-9.1 |
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
(when (load "flymake" t) | |
;; python syntax check | |
(defun flymake-pyflakes-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) | |
(local-file (file-relative-name | |
temp-file | |
(file-name-directory buffer-file-name))) | |
(pycheck-bin (concat my-emacs-bin-directory |
NewerOlder