Skip to content

Instantly share code, notes, and snippets.

View acoshift's full-sized avatar
🔥
ლ(*꒪ヮ꒪*)ლ

Thanatat Tamtan acoshift

🔥
ლ(*꒪ヮ꒪*)ლ
View GitHub Profile
@acoshift
acoshift / App.vue
Created August 9, 2017 14:47
Vue + Vue-Rx
<template>
<div id="app">
<input ref="q">
<button v-stream:click="q$">Search</button>
<div>
<h1>{{ topic }} ({{ page }} / {{ totalPage }})</h1>
<select v-stream:change="perPage$">
<option :value="10">10</option>
<option :value="15">15</option>
<option :value="20">20</option>
@acoshift
acoshift / gen-client.sh
Last active March 21, 2019 04:25
Generate self-signed certification for server-client
#!/bin/bash
openssl genrsa -out $1.key 2048
openssl rsa -in $1.key -out $1.key
chmod 400 $1.key
openssl req -new -key $1.key -out $1.csr -subj "/CN=$1"
openssl x509 -req -in $1.csr -days 365 -CA server.crt -CAkey server.key -out $1.crt -CAcreateserial
rm $1.csr
@acoshift
acoshift / nginx.tmpl
Created July 15, 2017 19:40
nginx ingress controller template for gce tcp lb
{{ $cfg := .Cfg }}
{{ $IsIPV6Enabled := .IsIPV6Enabled }}
{{ $healthzURI := .HealthzURI }}
{{ $backends := .Backends }}
{{ $proxyHeaders := .ProxySetHeaders }}
daemon off;
worker_processes {{ $cfg.WorkerProcesses }};
pid /run/nginx.pid;
{{ if ne .MaxOpenFiles 0 }}
@acoshift
acoshift / .gitconfig
Last active March 14, 2020 23:40
.gitconfig [alias]
[alias]
cm = commit
co = checkout
p = push
pp = pull
tags = tag -l
b = branch
bb = branch -a
bd = branch -D
pod = push origin --delete
@acoshift
acoshift / Checkbox.vue
Created January 3, 2017 11:20
vuejs-semantic-checkbox
<template lang="pug">
.ui.checkbox
input(ref='input', type='checkbox')
label
slot
</template>
<script>
export default {
props: ['value'],
@acoshift
acoshift / auth-service-rxjs.js
Created December 31, 2016 13:27
Auth Service using RxJS for store global state
import { Observable, BehaviorSubject } from 'rxjs'
import axios from 'axios'
const API_URL = 'http://localhost:8080'
const API = {
get (url) {
return Observable.fromPromise(axios.get(API_URL + url))
}
}
@acoshift
acoshift / index.html
Created December 22, 2016 05:35
Vuejs Global State + Mixin
<!doctype>
<html>
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.6/vue.js"></script>
<script>
// create single state instance
const state = {
value: 0
}