Skip to content

Instantly share code, notes, and snippets.

View wingyplus's full-sized avatar
😶‍🌫️
Burned out

Thanabodee Charoenpiriyakij wingyplus

😶‍🌫️
Burned out
View GitHub Profile
@wingyplus
wingyplus / file_server_v1.ex
Last active January 12, 2020 15:23
Practicing Elixir by using exercise from Programming Erlang 2nd edition
defmodule FileServer do
@doc """
starting FileServer process.
"""
def start(dir \\ ".") do
spawn(FileServer, :loop, [dir])
end
def loop(dir) do
receive do
$ ./configure --enable-rust-debug
checking for xcrun... xcrun
checking for make... yes
checking for GNU Make... make
checking build system type... x86_64-apple-darwin19.2.0
checking host system type... x86_64-apple-darwin19.2.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
@wingyplus
wingyplus / mymath.tcl
Last active September 11, 2019 10:05
Simple unit test in Tcl
proc sum { a b } {
return [expr $a + $b]
}
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"strconv"
"strings"
"time"
async function cacheDo() {
return await cache.do(key, async () => {
return await db.findOne();
});
}
(async () => {
let missyou = await cacheDo();
})()
importClass(Packages.org.springframework.web.context.ContextLoader);
importClass(Packages.org.alfresco.service.cmr.repository.TransformationOptions);
var context = ContextLoader.getCurrentWebApplicationContext();
var alfThumbnailService = context.getBean("thumbnailService");
alfThumbnailService.updateThumbnail(document.getThumbnail("webpreview").nodeRef, new TransformationOptions());
@wingyplus
wingyplus / cleaner.js
Created July 11, 2013 07:30
Delete all file in archive store
importClass(Packages.org.springframework.web.context.ContextLoader);
importClass(Packages.org.alfresco.service.cmr.repository.StoreRef);
var ctx = ContextLoader.getCurrentWebApplicationContext();
var archiveService = ctx.getBean("nodeArchiveService");
archiveService.purgeAllArchivedNodes(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"));
@wingyplus
wingyplus / hangman.exs
Created September 22, 2018 11:33
Hangman implementation in Elixir
defmodule Hangman do
def hangman(secret_word, inputs) do
MapSet.subset?(MapSet.new(String.graphemes(secret_word)), MapSet.new(inputs))
end
end
package hangman
import "strings"
func Hangman(word string, inputs []string) bool {
for _, input := range inputs {
if word = strings.Replace(word, input, "", -1); word == "" {
return true
}
}
@wingyplus
wingyplus / 1_Ruby.md
Created September 10, 2011 12:57
Ruby Note for me.

Ruby

เริ่มแรก

puts "hello, world"

สิ่งที่ต้องจำไว้

  • Ruby ใช้เป็น code block ไม่ได้ใช้ {} ครอบ block นั้น