Skip to content

Instantly share code, notes, and snippets.

@vbauerster
vbauerster / .vimrc
Created September 11, 2017 10:36 — forked from diyan/.vimrc
Alexey Diyan's vim configuration file
" This must be first, because it changes other options as a side effect.
set nocompatible
" On Windows use '.vim' instead of 'vimfiles' to make sync easier
let s:ms_win = (has('win16') || has('win32') || has('win64'))
if s:ms_win
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
set shell=/bin/sh
endif
/* https://tour.golang.org/flowcontrol/8
Exercise: Loops and Functions
As a simple way to play with functions and loops, implement the square root
function using Newton's method.
In this case, Newton's method is to approximate Sqrt(x) by picking a starting
point z and then repeating: z - (z*z-x)/(2*z)
Original formula: https://tour.golang.org/content/img/newton.png
use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn main() {
println!("Set your secret (1-100):");
let mut secret = String::new();
io::stdin()
.read_line(&mut secret)
.expect("Failed to read line");
package main
import (
"flag"
"fmt"
"log"
"net/http"
"net/url"
"os"
"strings"
@vbauerster
vbauerster / sync_bench.md
Last active March 2, 2019 10:59
go sync package benchmarks: mbp 2013 vs mbp 2017

Benchmarks done with go 1.12 version.

mbp 2017 results

  • CPU: Intel Core i7-7820HQ @ 2.90GHz
  • RAM: 16 GB 2133 MHz LPDDR3
goos: darwin
goarch: amd64
pkg: sync
BenchmarkCond1-8                   	10000000	       236 ns/op	       0 B/op	       0 allocs/op
{
"vim.leader": "<space>",
"vim.easymotion": true,
"vim.neovimPath": "/usr/local/bin/nvim",
"vim.enableNeovim": true,
"vim.insertModeKeyBindings": [
{
"before": [",", "."],
"after": ["<Esc>"]
}
let mapleader = " "
"set showtabindices
"set smoothscroll
map g{ previousTab
map g} nextTab
" Code blocks (see below for more info)
getIP() -> {{
httpRequest({url: 'http://api.ipify.org/?format=json', json: true},
function(res) { Status.setMessage('IP: ' + res.ip); });
}}
" exrc for wasavi
set tabstop=4
set number
set jkdenotative
set cursorline
set cursorcolumn
set theme=solarized
" map! is insert mode
map! ,. <esc>
import {HttpClient} from 'aurelia-fetch-client'
import {Authentication} from './authentication';
import {BaseConfig} from './baseConfig'
import {inject} from 'aurelia-framework';
import {Storage} from './storage';
@inject(HttpClient, Authentication, Storage, BaseConfig)
export class FetchConfig {
constructor(httpClient, authService, storage, config){
this.httpClient = httpClient;
@vbauerster
vbauerster / main.go
Last active April 8, 2018 02:27
Diff btw chan size 0 and 1
package main
import (
"fmt"
"time"
)
func main() {
// c := make(chan struct{}, 1)
c := make(chan struct{})