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
""" | |
Python helps you play `Letterpress <http://www.atebits.com/letterpress/>`_. | |
Requires `NLTK library <http://nltk.org/>`_ and cmudict corpus. | |
You can install the latter by executing the following two lines in Python shell: | |
>>> import nltk | |
>>> nltk.download() | |
I'd consider it cheating, though! |
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 getReversed (str) { | |
var i, idx, result = []; | |
for (i = 0; i < str.length; ++i) { | |
idx = (i % 2) ? (str.length - Math.ceil((i + 1) / 2)) : Math.ceil(i / 2); | |
result.push(str[idx]); | |
} | |
return result.join(''); | |
} |
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
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el | |
index 447d7fd..27bba4a 100644 | |
--- a/lisp/term/ns-win.el | |
+++ b/lisp/term/ns-win.el | |
@@ -929,6 +929,11 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") | |
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system)) | |
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ()) | |
+(defun ns-toggle-fullscreen () |
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 'flymake) | |
(defun flymake-jslint-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)))) | |
;; Change it to path of the jslint.js executable file on your system | |
(list "/Users/zuber/node_modules/jslint/bin/jslint.js" (list local-file)))) |
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
%#!/usr/bin/env swipl -q -g main -s | |
% | |
% ^ Uncomment the line above and make this file executable | |
% to turn it into a valid SWI Prolog script | |
% | |
% (c) Marek Stepniowski, 222149 <[email protected]> | |
:- dynamic edge/5. | |
% ----------------------- | |
% Application entry point |
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
# Required libraries: | |
# | |
# * vobject <http://vobject.skyhouseconsulting.com/> | |
# | |
# Copyright (C) 2011 Marek Stepniowski <[email protected]> | |
# | |
# This program is free software. It comes without any warranty, to | |
# the extent permitted by applicable law. You can redistribute it | |
# and/or modify it under the terms of the Do What The Fuck You Want | |
# To Public License, Version 2, as published by Sam Hocevar. See |
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 -*- | |
# Works on the `output.xml` generated by running `pdf2txt.py -o output.xml FILE`, | |
# where FILE is the programme of Science Festival in Warsaw in PDF. | |
# | |
# Required libraries: | |
# | |
# * vobject <http://vobject.skyhouseconsulting.com/> | |
# * lxml <http://codespeak.net/lxml/> | |
# | |
# Script `pdf2txt.py` is part of package PDFMiner <http://www.unixuser.org/~euske/python/pdfminer/index.html>. |
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 annoying.decorators import render_to | |
@render_to('template.html') | |
def foo(request): | |
bar = Bar.object.all() | |
return {'bar': bar} | |
# equals to | |
from django.views.generic.simple import direct_to_template |
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
# Create your views here. | |
from django.shortcuts import render_to_response | |
from gallery.models import Gallery | |
def gallery_list(request): | |
galleries = Gallery.objects.all() | |
return render_to_response('gallery/gallery_list.html', {'galleries': galleries}) |
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 django.db import models | |
from django.contrib.auth.models import User | |
class Gallery(models.Model): | |
title = models.CharField( max_length=80) | |
owner = models.ForeignKey(User) | |
created_at = models.DateTimeField(auto_now_add=True) | |
class Meta: | |
ordering = ['title', 'created_at'] |