Skip to content

Instantly share code, notes, and snippets.

View yrashk's full-sized avatar
🎯
Being productive

Yurii Rashkovskii yrashk

🎯
Being productive
View GitHub Profile
@yrashk
yrashk / leven.ex
Created November 28, 2012 20:44 — forked from plukevdh/leven.ex
Levenshtein in elixir
defmodule Levenshtein do
def first_letter_check(one_letter, two_letter) do
case one_letter == two_letter do
true -> 0
false -> 1
end
end
def distance(string_1, string_1), do: 0
def distance(string, ''), do: :string.len(string)
@yrashk
yrashk / leven.ex
Created November 28, 2012 20:58 — forked from plukevdh/leven.ex
Levenshtein in elixir
defmodule Levenshtein do
def first_letter_check(one_letter, two_letter) do
case one_letter == two_letter do
true -> 0
false -> 1
end
end
def distance(string_1, string_1), do: 0
def distance(string, ''), do: :string.len(string)
defmodule Package do
use Hypnotoad
@shortdoc "Manages operating system packages (install, uninstall)"
requires Apt.Source, attributes[:apt_source], only: attributes[:apt_source] != nil
def test(opts) do
lock {host, :apt} do
{status, _} = shell("dpkg -l #{opts[:name]} >/dev/null 1>/dev/null 2>/dev/null", status: true)
end

Keybase proof

I hereby claim:

  • I am yrashk on github.
  • I am yrashk (https://keybase.io/yrashk) on keybase.
  • I have a public key whose fingerprint is 7AE1 96E3 F604 D870 22EF 7B70 B23A 6D8C 00A9 65A7

To claim this, I am signing this object:

$ ./gitchain Info | json_pp
{
"Mining" : {
"Miners" : {
"954aba53482f0a27f33953d83cb08e629facc4c836c3bb7daa54b42bc52689ac" : {
"StartTime" : "2014-05-15T10:30:29.189687628+08:00"
},
"557ca23e1ce37303c71797829096d0a42bb5b07bc2751f76d0d61da37e00a7c4" : {
"StartTime" : "2014-05-15T10:30:27.59290694+08:00"
},
func TestErr(t *testing.T) {
passed := false
handled := false
err.Handle("this kind of failure", func(e error) {
handled = true
}).
Handle("that kind of failure", func(e error) {
}).
Run(func(h err.H) {
v := h(err.Ignore)(exampleFunction())
Verifying that +yrashk is my Bitcoin username. You can send me #bitcoin here: https://onename.io/yrashk
@yrashk
yrashk / OFFER.md
Last active October 1, 2015 05:46
We will document, design and produce API bindings for all popular languages

Implementable

API Accessibility Program

TL;DR: We will document, design and produce API bindings for all popular languages.


Somebody once said, "good APIs are like good jokes — you don't need to explain them."

@yrashk
yrashk / gist:bc9e2d3a0c6c0c33bebc18113eb3b282
Created April 3, 2016 16:46 — forked from knu/gist:111055
How to mass-rename tags and push them with Git
# Rename tags named foo-bar-#.#.# to v#.#.# and push the tag changes
git tag -l | while read t; do n="v${t##*-}"; git tag $n $t; git push --tags ; git tag -d $t; git push origin :refs/tags/$t ; done
@yrashk
yrashk / User.java
Last active April 12, 2016 23:46
Pseudocode-ish User's email retrieval
// Pseudocode-ish User's email retrieval
public class User {
public String email() {
return query(equal(EmailChanged.ID, id),
descending(EmailChanged.TIMESTAMP)).first().
email();
}
}