Skip to content

Instantly share code, notes, and snippets.

@groony
groony / time_slice.rb
Created September 17, 2019 07:41 — forked from vertexclique/time_slice.rb
Time Slice for Ruby methods (milliseconds)
module TimeSlice
def self.time_slice(slice)
bgntime = Time.now
id = 0
loop do
id=id+1
puts "#{id} works"
# do your work here like above line
# and pass milliseconds for "slice" var
@aonemd
aonemd / subtitle_extractor.rb
Last active March 7, 2022 14:05
A Ruby script to extract text from images with subtitles and rename the image file to the extracted text (requires Tesseract to be installed)
require 'pathname'
require 'open3'
require 'mini_magick'
SRC_DIR = '/path/to/src/dir/'.freeze
TMP_DIR = '/path/to/tmp/dir/'.freeze
class TextReader
def initialize(input_path, output_path)
@input_path = input_path
@masutaka
masutaka / circle.yml
Created April 16, 2017 10:25
capistrano deployment using CircleCI 2.0
version: 2
jobs:
build:
docker:
- image: ruby:2.3.3-alpine
working_directory: /home/circleci/masutaka.net
steps:
- setup_remote_docker:
# https://circleci.com/docs/2.0/docker-layer-caching/
reusable: true
@laurent22
laurent22 / levenshteinDistance.go
Last active November 22, 2018 16:06
Golang function to calculate Levenshtein distance between two strings. Adapted from Wikipedia article.
import (
"math"
"strings"
)
func levenshteinDistance(s string, t string) int {
// degenerate cases
s = strings.ToLower(s)
t = strings.ToLower(t)
if (s == t) { return 0 }
@evtuhovich
evtuhovich / gist:1134998
Created August 9, 2011 19:43
Список вопросов для собеседования
Ruby
принципиальное различие скриптовых и “обычных” языков
3 принципа ООП
реализация множественного наследования в ruby
duck typing
многопоточность в ruby
Rails
что такое MVC и зачем это нужно
локига в контроллере, должна ли быть и почему
синхронные и асинхронные операции — предложить варианты решения