Skip to content

Instantly share code, notes, and snippets.

@tzvetkoff
tzvetkoff / README.md
Last active April 11, 2018 14:07
JetBrains Toolbox CLI Scripts

JetBrains Toolbox CLI Scripts

JetBrains Toolbox fails to update it's CLI scripts from time to time, and even if it does - they don't work as expected.

This is my ugly attempt to fix this on OSX.

@tzvetkoff
tzvetkoff / rescuable.rb
Created August 31, 2017 11:20
rescuable.rb
#
# Rescuable allows you to lazily wrap methods with a rescue logic outside.
# Example:
#
# class Foo
# extend Rescuable
#
# def kaboom
# raise RuntimeError, 'This will be rescued and will return 1337'
# raise 'This, however, will not be rescued'
@tzvetkoff
tzvetkoff / keybase.md
Created November 12, 2016 02:12
keybase.md

Keybase proof

I hereby claim:

  • I am tzvetkoff on github.
  • I am tzvetkoff (https://keybase.io/tzvetkoff) on keybase.
  • I have a public key whose fingerprint is 2048 FDA4 BCA7 5247 569C 4936 A1AB 5FAA 53E8 6CC3

To claim this, I am signing this object:

@tzvetkoff
tzvetkoff / zwch.py
Last active January 2, 2018 08:20
Sublime Text plugin that tries to detect and mark zero-width characters
import sublime
import sublime_plugin
class ShowZeroWidthCharacters(sublime_plugin.EventListener):
"""
Tries to detect and mark zero-width joiners, non-joiners, and other invisible characters.
Most of the characters were detected by manually testing code points from C++ specs.
http://en.cppreference.com/w/cpp/language/identifiers
"""
@tzvetkoff
tzvetkoff / httpd.js
Last active February 17, 2022 22:36
Simple NodeJS HTTPd
#!/usr/bin/env node
const
fs = require('fs'),
http = require('http'),
https = require('https')
path = require('path'),
url = require('url');
class WebServer {
@tzvetkoff
tzvetkoff / gist:7287456
Last active January 8, 2019 06:44
Make it more test-ish
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', :github => 'rails/rails'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@tzvetkoff
tzvetkoff / gist:3371287
Created August 16, 2012 15:55
renegator.rb
#!/usr/bin/env ruby
require 'set'
require 'cgi'
require 'exifr'
require 'rmagick'
require 'fileutils'
module HTML
@tzvetkoff
tzvetkoff / gist:3371275
Created August 16, 2012 15:53
kombinator.rb
#!/usr/bin/env ruby
require 'fileutils'
require 'exifr'
Dir['Photos/*.*'].each { |filename|
source = "#{Dir.pwd}/#{filename}"
destination = nil
begin
@tzvetkoff
tzvetkoff / gist:3182946
Created July 26, 2012 16:08
foobarbazbaz.rb
def collection_from_string(songs_as_string, artist_tags)
songs_as_string.strip.split("\n").map do |line|
name, artist, genre, tags = line.split('.').map(&:strip)
genre, subgenre = genre.split(',').map(&:strip)
tags = tags.to_s.split(',').push(genre).push(subgenre).concat(Array(artist_tags[artist])).reject(&:nil?).map(&:strip).map(&:downcase)
{:name => name, :artist => artist, :genre => genre, :subgenre => subgenre, :tags => tags}
end
end