Skip to content

Instantly share code, notes, and snippets.

View nskeip's full-sized avatar
🕶️

Nikita Hismatov nskeip

🕶️
View GitHub Profile
@nskeip
nskeip / compass-create-960
Created March 22, 2012 19:00
Все время забываю как создать проект в компасе, чтобы с 960
compass create -r ninesixty vizavi-layout --using 960 --syntax sass --sass-dir "sass" --css-dir "css" --javascripts-dir "js" --images-dir "images"
@nskeip
nskeip / regognize_phone.py
Created March 17, 2012 18:00
Helps to recognize a celular phone number in a string with non-celular numbers.
#-*- coding: UTF-8 -*-
import re
def recognize_phone(s):
"""
>>> f = recognize_phone
>>> f(u'8-912-234-56-78')
u'8-912-234-56-78'
@nskeip
nskeip / permutations.py
Created February 23, 2012 06:06
Permutations algorythm implementation.
def permutations(l):
"""
>>> f = permutations
>>> f(['a', 'b'])
[('a', 'b'), ('b', 'a')]
>>> f(['a', 'b', 'c'])
[('a', 'b', 'c'), ('a', 'c', 'b'), ('b', 'a', 'c'), ('b', 'c', 'a'), ('c', 'a', 'b'), ('c', 'b', 'a')]
"""
if len(l) == 1:
@nskeip
nskeip / Gemfile
Created February 22, 2012 07:56
Configuring rails for haml + sass + compass (960)
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@nskeip
nskeip / ElementFlowAtomicOutputWrapper.py
Created February 17, 2012 08:35
Atomic wrapper for ElementFlow
# If you create xml via ElementFlow and make some bad things (and exceptions raise)
# you will get invalid xml (only a criple part of the xml you wish to have).
#
# This is a wrapper for ElementFlow for 'atomic' xml: it either created or not.
import shutil
import tempfile
class ElementFlowAtomicOutputWrapper(object):
def __init__(self, out_file_path):