Skip to content

Instantly share code, notes, and snippets.

View gokusenz's full-sized avatar
🎯
Focusing

Nattawut Ruangvivattanaroj gokusenz

🎯
Focusing
View GitHub Profile
@gokusenz
gokusenz / easyget.go
Created August 27, 2017 06:11 — forked from montanaflynn/easyget.go
GET JSON array in Golang
package easyget
import (
"io"
"io/ioutil"
"net/http"
)
// Define Request struct
type Request struct {
@gokusenz
gokusenz / sample.js
Created September 14, 2017 12:38
Javascript Example Test
const lookupTaxRate = (region) => {
if(region == '') {
throw 'Region can\'t be blank!'
}
var taxRate = 0.5
if(region == 'Chiang Mai') {
*** Settings ***
Library Selenium2Library
*** Variables ***
${url} https://medium.com/@nottyo/
@{chrome_arguments} --disable-infobars --headless --disable-gpu
${page_text} Test Automation Engineer. Let’s make awesome tests
${timeout} 10s
*** Test Cases ***
var input = "'Warehouse','Local Release','Local Release DA'";
var regex = /'(.*?)'/g;
var matches, output = [];
while (matches = regex.exec(input)) {
output.push(matches[1]);
}
const removeTag = (html) => {
html = html.replace(/(\r\n|\n|\r)/g,"").replace(/>\s+</g, "><");
return html
}
var str = "The quick brown fox jumped over the box like an ox with a sox in its mouth";
str.match(/\w(ox)/g); // ["fox", "box", "sox"]
// match (when used with a 'g' flag) returns an Array with all matches found
// if you don't use the 'g' flag then it acts the same as the 'exec' method.
str.match(/\w(ox)/); // ["fox", "ox"]
/\w(ox)/.exec(str); // ["fox", "ox"]
@gokusenz
gokusenz / emoji.go
Created November 1, 2017 09:12 — forked from YamiOdymel/emoji.go
Print the emoji with Golang. https://play.golang.org/p/yPgKw3Z9HW
// (c) 2017 Yami Odymel
// This code is licensed under MIT license.
package main
import (
"fmt"
"html"
"strconv"
)
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
#function git_prompt_info() {
# ref=$(git symbolic-ref HEAD 2> /dev/null) || return
# echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX$(parse_git_dirty)"
#}
function get_pwd(){
git_root=$PWD
while [[ $git_root != / && ! -e $git_root/.git ]]; do
myfuncion() { mv $1 $2; }
export GOPATH="${PWD}"
{
"go.gopath": "${workspaceRoot}"
}