Skip to content

Instantly share code, notes, and snippets.

View ndyakov's full-sized avatar
💭

Nedyalko Dyakov ndyakov

💭
View GitHub Profile
@ndyakov
ndyakov / gitclb.fish
Last active June 22, 2018 05:04
[fish] Remove local git branches that are not in origin.
function gitclb --description 'Remove local branches that are not in origin'
git fetch -p
set default N
set options "y/N"
for option in $argv
switch "$option"
case "-Y" "--yes"
set default Y
@ndyakov
ndyakov / prepend_test.go
Created March 8, 2015 14:00
benchmark prepend golang
package main
import "testing"
func BenchmarkPrependAppend(b *testing.B) {
s := []string{"one", "two", "three", "four"}
word := "zero"
for i := 0; i < b.N; i++ {
s = append([]string{word}, s...)
}
@ndyakov
ndyakov / main.go
Last active August 29, 2015 14:09
Sleeping Barber Problem
package main
import (
"fmt"
"math/rand"
"time"
)
type Barber struct {
Customer chan *Customer
@ndyakov
ndyakov / koch.html
Last active August 29, 2015 14:01
koch
<html>
<head>
<title> Koch Snowflake, maybe?</title>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.10.4/themes/dark-hive/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script>
KochSnowflake = function(elem) {
this.canvas = elem;
this.context = this.canvas.get(0).getContext("2d");