This file contains 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
fn main() { | |
let needle = "list".to_string(); | |
let haystack = ["some".to_string(), "long".to_string(), "list".to_string(), "of".to_string(), "strings".to_string()].to_vec(); | |
if let Some(str) = haystack.iter().find(|&s| *s == needle) { | |
println!("{}", needle); | |
} else { | |
println!("Nothing there..."); | |
} | |
} |
This file contains 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 ( | |
git "github.com/libgit2/git2go" | |
"log" | |
) | |
func credentialsCallback(url string, username string, allowedTypes git.CredType) (git.ErrorCode, *git.Cred) { | |
ret, cred := git.NewCredSshKey("git", "/home/vagrant/.ssh/id_rsa.pub", "/home/vagrant/.ssh/id_rsa", "") | |
return git.ErrorCode(ret), &cred |
This file contains 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
#!/bin/bash | |
## Install Golang Stable 64Bits on Linux (Debian|Ubuntu|OpenSUSE|CentOS) | |
## http://www.linuxpro.com.br/2015/06/golang-aula-1-instalacao-da-linguagem-no-linux.html | |
## Run as root (sudo su) | |
## Thank's @geosoft1 | @gwmoura | |
GO_URL="https://go.dev/dl" | |
GO_VERSION=$(curl -s 'https://go.dev/VERSION?m=text'|head -n1) | |
GO_FILE="$GO_VERSION.linux-amd64.tar.gz" |
This file contains 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
public class ObjectsAndEquals | |
{ | |
public static void main(String[] args) | |
{ | |
Integer m0 = 127; | |
Integer m1 = 127; | |
System.out.println(m0 == m1); // true | |
System.out.println(m0.equals(m1)); // true | |
Integer n0 = 128; |