Skip to content

Instantly share code, notes, and snippets.

Andrey Tarantsov andreyvit

Block or report user

Report or block andreyvit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
andreyvit / ObservationPlayground.swift
Last active Aug 29, 2015
Code from “In search of a clean closure-based observation API in Swift” on Apple Dev Forums
View ObservationPlayground.swift
import Foundation
func weakify<T: AnyObject>(object: T, block: (T) -> Void) -> () -> Void {
weak var weakObject = object
return {
if let strongObject = weakObject {
View ATUnclippedTextField.h
#import <Cocoa/Cocoa.h>
// NSTextField has alignmentRectInsets = {.left=.right=3, .top=.bottom=0}, so
// when autolayout aligns NSTextField to its container's side margin (e.g. to x=0),
// the actual x position is -3, and the label gets clipped.
// ATUnclippedTextField compensates for that by overriding drawRect to extend
// the clipping rect by alignmentRectInsets.
View 1_fpdi_with_annots.php
require_once 'pdflib/fpdf.php';
require_once 'pdflib/fpdi.php';
// FPDI extension that preserves hyperlinks when copying PDF pages.
// (c) 2012, Andrey Tarantsov <>, provided under the MIT license.
// Published at:
View gist:5944549
// GorillaScript as of 2013-07-08
macro assert-equals(x, y)
@maybe-cache x, #(set-x, x)
@maybe-cache y, #(set-y, y)
if $set-x != $set-y
throw new Error("assert-equals failed: " & $x & " != " & $y)
macro assert-deep-equals(x, y)
andreyvit / DualNibViewController.h
Last active Dec 17, 2015
An old code fragment demonstrating the use of a separate landscape .nib in a UIViewController (the view hierarchies of the two .nib files must match exactly, and only the frames are adjusted when going into landscape, although you can obviously add more properties to the save/restore code).
View DualNibViewController.h
#import <Foundation/Foundation.h>
@interface DualNibViewController : UIViewController {
NSDictionary *_viewStates;
andreyvit /
Created Feb 7, 2013
LiveReload development instructions. Basically a wiki for LiveReload hackers.

Developing LiveReload on a Mac

Mac directory structure

Under ~/dev/livereload:

View gist:4713440
View Delegate-README.txt
В этой директории лежит delegate (универсальный прокси-сервер и сервер
контекта) для Windows. Остальные версии можно найти на сайте.
Вот примерный список функций:
* входящие (т.е. с вашего компьютера) соединение по протоколам
HTTP, HTTPS, "HTTPS-tunnel", FTP, NNTP, Telnet, SOCKS и др.
* исходящие соеднинения (т.е. к настоящим серверам) по тем же
протоколам, причём, например, можно FTP (на входе) пустить
через SOCKS-прокси (или через HTTPS-прокси)
* кэширование запросов (с управляемыми параметрами)
andreyvit / UglifyJS-0001-Fix-broken-calls-of-complex-binary-expressions-471.patch
Created Nov 1, 2012
View UglifyJS-0001-Fix-broken-calls-of-complex-binary-expressions-471.patch
From 46089d511b7f7d718b79c4ce8a685366e1c73161 Mon Sep 17 00:00:00 2001
From: Andrey Tarantsov <>
Date: Thu, 1 Nov 2012 10:10:34 +0700
Subject: [PATCH] Fix broken calls of complex binary expressions [#471]
When deciding whether to parenthesize the expression being called, a
simple test of f.charAt(0) results in a broken code when calling a
complex expression which just happens to start with a paren but is
not actually parenthesized.
andreyvit / npm-package.woot.yml
Created Jul 9, 2012
Wootemplate for an npm package
View npm-package.woot.yml
- name: name
example: FooBar
description: The name of your package
- name: description
example: Cool package.
description: A short description of your package
- name: user-name
example: Andrey Tarantsov
description: Package author's full name
You can’t perform that action at this time.