Skip to content

Instantly share code, notes, and snippets.

View zaratan's full-sized avatar
🐢
Tinkering

Denis <Zaratan> Pasin zaratan

🐢
Tinkering
View GitHub Profile
@zaratan
zaratan / for_vs_map.rb
Last active March 8, 2021 05:47 — forked from carlosantoniodasilva/while-vs-each_with_index.rb
Benchmark while vs each_with_index. And for vs map. RE: https://github.com/rails/rails/pull/12065
require 'benchmark/ips'
ARRAY = [1,2,3,1,'2',4,'5',6,7,8,9,'10']
Benchmark.ips do |x|
x.report("for") {
result = []
for number in ARRAY
result << number.to_s
end
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<title>JS Bin</title>
<style id="jsbin-css">
.wheredivgoes {
@zaratan
zaratan / pig_latin.rb
Last active February 10, 2017 13:22 — forked from felhix/pig_latin.rb
#write your code here
def vowel?(letter)
['a', 'e', 'i', 'o', 'u'].include?(letter)
end
def process_letter(char, hash)
if hash[:first_vowel_not_found]
if vowel?(char)
hash[:before_first_vowel] << "ay"
class Request
constructor: (adr) ->
this.adr = adr
start: () ->
alert("start")
results: () ->
alert("result")
BEGIN{s,,=]=>%-{<-|}<&|`{,,y; -/:-@[-`{-};`-{/' -;,s,(.+)'$,$1*',&&s&&$_&gesex}