A simple guide to install PyQt5 on Mac OS X 10.9 (Maverick) and use python 3.4 on a virtualenv.
- xcode 5.1.1
- python 3.4.0
- Qt libraries 5.2.1
;; yasnippet | |
(add-to-list 'load-path | |
"~/.emacs.d/yasnippet") | |
(require 'yasnippet) ;; not yasnippet-bundle | |
(yas/initialize) | |
(yas/load-directory "~/.emacs.d/yasnippet/snippets") | |
;; scala-mode | |
(add-to-list 'load-path | |
"~/.emacs.d/scala-mode") |
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |
######################### | |
# .gitignore file for Xcode5 | |
# | |
# NB: if you are storing "built" products, this WILL NOT WORK, | |
# and you should use a different .gitignore (or none at all) | |
# This file is for SOURCE projects, where there are many extra | |
# files that we want to exclude | |
# | |
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# and https://gist.github.com/adamgit/3786883 |
#! /usr/bin/env python | |
""" Convert values between RGB hex codes and xterm-256 color codes. | |
Nice long listing of all 256 colors and their codes. Useful for | |
developing console color themes, or even script output schemes. | |
Resources: | |
* http://en.wikipedia.org/wiki/8-bit_color | |
* http://en.wikipedia.org/wiki/ANSI_escape_code |
function logClass(target: any) { | |
// save a reference to the original constructor | |
var original = target; | |
// a utility function to generate instances of a class | |
function construct(constructor, args) { | |
var c : any = function () { | |
return constructor.apply(this, args); | |
} |
I'm a Python programmer and frequently work with the excellent [virtualenv][] tool by Ian Bicking.
Virtualenv is a great tool on the whole but there is one glaring problem: the activate
script that virtualenv provides as a convenience to enable its functionality requires you to source it with your shell to invoke it. The activate
script sets some environment variables in your current environment and defines for you a deactivate
shell function which will (attempt to) help you to undo those changes later.
This pattern is abhorrently wrong and un-unix-y. activate
should instead do what ssh-agent
does, and launch a sub-shell or sub-command with a modified environment.
class Point(object): | |
__slots__ = ('x', 'y') | |
def __init__(self, x=0, y=0): | |
self.x = x | |
self.y = y | |
def __setattr__(self, name, value): | |
# print self, name, value |
# Method 1: A decorator | |
def singleton(class_): | |
instances = {} | |
def getinstance(*args, **kwargs): | |
if class_ not in instances: | |
instances[class_] = class_(*args, **kwargs) | |
return instances[class_] | |
return getinstance |