This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "vim.leader": "<space>", | |
| "vim.easymotion": true, | |
| "vim.neovimPath": "/usr/local/bin/nvim", | |
| "vim.enableNeovim": true, | |
| "vim.insertModeKeyBindings": [ | |
| { | |
| "before": [",", "."], | |
| "after": ["<Esc>"] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); }); | |
| }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " exrc for wasavi | |
| set tabstop=4 | |
| set number | |
| set jkdenotative | |
| set cursorline | |
| set cursorcolumn | |
| set theme=solarized | |
| " map! is insert mode | |
| map! ,. <esc> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func main() { | |
| inch := make(chan int) | |
| outch := make(chan int) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| ) | |
| func main() { | |
| var wg sync.WaitGroup | |
| done := make(chan struct{}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "net/url" | |
| "os" | |
| "strings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| type person struct { | |
| Name string | |
| Age int | |
| } | |
| func main() { |
NewerOlder