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 / ci.exs
Last active January 31, 2024 12:28
Mix.install([
{:dagger, "~> 0.9.4"}
])
defmodule Ci do
alias Dagger.{Client, Container, Directory, Host}
@workdir "/app"
# TODO: change to your release name.
@release "hello_world_dagger"
@wingyplus
wingyplus / test_subprocess.py
Last active October 15, 2022 06:24
mocking subprocess
import unittest
import mock
import subprocess
class PythonSubprocessTest(unittest.TestCase):
class MockPopen(object):
def __init__(self):
pass
def communicate(self, input=None):
@wingyplus
wingyplus / headver.exs
Last active April 18, 2022 04:08
headver Elixir implementation
# headver.exs - a headver implementation in Elixir. See https://github.com/line/headver.
#
# Run
# $ elixir headver.exs --head=5 --build=23 --suffix=qa
# 5.2142.23+qa
Mix.install([
{:timex, "~> 3.7"}
])
@wingyplus
wingyplus / feedgroup.groovy
Created April 17, 2012 10:26
Facebook group feed json
@Grapes(
@Grab(group='com.google.code.gson', module='gson', version='2.1')
)
import com.google.gson.JsonParser
import groovy.json.JsonOutput
def feed = 'https://graph.facebook.com/136284706423146/feed?access_token=AAACEdEose0cBAAVRXgYnx5ZA24b9HK9ROQRSJN4EoSZBU8xbI0ZAE9bJmEm6lf2kF9yPcr8t74nuFNKdABNoL88Mc8F9jEpU70Y17O9CpBucO00TbJq'
def json = new JsonParser().parse(feed.toURL().text)
@wingyplus
wingyplus / Program.fs
Last active November 4, 2020 07:22
Benchmark fibonacci on F#
// Learn more about F# at http://fsharp.org
open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running
let rec fibonacci n =
match n with
| 1 -> 1
| 2 -> 2
| n -> fibonacci (n - 1) + fibonacci (n - 2)
[None, Some(1), Some(2), None, Some(10)]
->Js.Array2.filter(a => Belt.Option.isSome(a))
->Js.Array2.map(n => Belt.Option.getExn(n))
->Js.log
Tue Aug 18 13:38:54 2020:["lsp#register_server", "server registered", "typescript support using typescript-language-server"]
Tue Aug 18 13:38:54 2020:["lsp#register_server", "server registered", "elixir-ls"]
Tue Aug 18 13:38:54 2020:["lsp#register_server", "server already registered", "typescript support using typescript-language-server"]
Tue Aug 18 13:38:54 2020:["lsp#register_server", "server registered", "typescript support using typescript-language-server"]
Tue Aug 18 13:38:54 2020:["lsp#register_server", "server already registered", "elixir-ls"]
Tue Aug 18 13:38:54 2020:["lsp#register_server", "server registered", "elixir-ls"]
Tue Aug 18 13:38:54 2020:["vim-lsp signs enabled"]
Tue Aug 18 13:38:54 2020:["vim-lsp virtual text enabled"]
Tue Aug 18 13:38:54 2020:["vim-lsp highlighting enabled"]
@wingyplus
wingyplus / Tests.cs
Created July 26, 2020 15:27
Learn C# from Unity. Use NUnit for test framework.
using System;
using NUnit.Framework;
namespace Syntax.Tests
{
public struct Vector2 : IFormattable
{
public float x, y;
public static Vector2 operator -(Vector2 a, Vector2 b)
@wingyplus
wingyplus / init.vim
Created May 11, 2020 04:16
A sample configuration for LSP
call plug#begin()
"
""" LSP
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
"
""" Language tools
@wingyplus
wingyplus / liff.js
Created March 19, 2020 12:49
LIFF wrapper with automatical replace when running under Cypress
/* eslint-disable no-undef */
// replaced liff when running in cypress sandbox
if (window.cy) {
console.log('liff: running in cypress sandbox')
window.liff = window.cy.liff
}
export default {
init() {
return new Promise((resolve, reject) =>