Skip to content

Instantly share code, notes, and snippets.

View barbuza's full-sized avatar
🇺🇦
Stand with Ukraine

Victor Kotseruba barbuza

🇺🇦
Stand with Ukraine
View GitHub Profile

Keybase proof

I hereby claim:

  • I am barbuza on github.
  • I am barbuza (https://keybase.io/barbuza) on keybase.
  • I have a public key whose fingerprint is C209 3BB7 037D 3426 5C96 9179 0430 D44B 8D5F 96E6

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am barbuza on github.
  • I am barbuza (https://keybase.io/barbuza) on keybase.
  • I have a public key ASDq4h8zPcR-6ZtpO5NIBDe9RI7EyfzdnlUik_2_rAw5Zwo

To claim this, I am signing this object:

function getEmptyIndexes(arr) {
var px;
var py;
var i;
var rows = [];
var columns = [];
for (i = 0; i < arr.length; i++) {
columns[i] = 0;
}
@barbuza
barbuza / bottomgirl.py
Created July 28, 2013 07:29
bottomgirl is not middleman
# -*- coding: utf-8 -*-
import os
import sys
import json
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("--haml", dest="haml", action="store_true", default=False,
@barbuza
barbuza / UILabel+TextTouch.h
Last active June 24, 2017 03:49
who said there is no links support in UILabel with attributed string?
#import <UIKit/UIKit.h>
@interface UILabel (TextTouch)
- (NSInteger)stringIndexUnder:(CGPoint)point;
@end
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
NSArray *gradientColors = @[(id)_startColor.CGColor, (id)_stopColor.CGColor];
NSArray *highlightedColors = @[(id)_stopColor.CGColor, (id)_startColor.CGColor];
CGGradientRef gradient = CGGradientCreateWithColors(colorspace, (__bridge CFArrayRef)gradientColors, NULL);
CGGradientRef highlightedGradient = CGGradientCreateWithColors(colorspace, (__bridge CFArrayRef)highlightedColors, NULL);
CGRect backgroundRect = rect;
UIBezierPath *backgroundPath = [UIBezierPath bezierPathWithRoundedRect:backgroundRect cornerRadius:3];
CGContextSaveGState(ctx);
Started GET "/phrases/show/1" for 202.152.201.168 at 2012-06-11 18:32:16 +0400
Processing by PhrasesController#show as HTML
Parameters: {"id"=>"1"}
Completed 500 Internal Server Error in 1ms
ActiveRecord::StatementInvalid (PG::Error: ERROR: prepared statement "a4" already exists
: SELECT "phrases".* FROM "phrases" WHERE "phrases"."id" = $1 LIMIT 1):
app/controllers/phrases_controller.rb:26:in `show'
module HashMethods
def instance_hash_method(method_name)
required_args = []
optional_args = []
original_method = instance_method(method_name)
original_method.parameters.each do |type, name|
if type == :req
required_args.push name
elsif type == :opt
@barbuza
barbuza / microdns.py
Created May 20, 2012 16:21
fake python dns server for use with mac /etc/resolver system
# -*- coding: utf-8 -*-
import re
import socket
class UnsupportedQuery(BaseException):
pass
#!/usr/bin/env ruby
file = STDIN.read[/lessc: ([^*]+\.less)/, 1] || ENV["TM_FILEPATH"]
outname = File.dirname(file) + "/" + File.basename(file, File.extname(file)) + ".css"
output = IO.popen("lessc \"#{file}\" 2>&1", "w+") do |pipe|
pipe.close_write
pipe.read
end