Skip to content

Instantly share code, notes, and snippets.

View vtno's full-sized avatar
👾
building

Tino Thamjarat vtno

👾
building
View GitHub Profile
@vtno
vtno / .tmux.conf.local
Created April 5, 2020 09:01
My basic tmux conf
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- navigation ----------------------------------------------------------------
# if you're running tmux within iTerm2
# - and tmux is 1.9 or 1.9a
@vtno
vtno / .zshrc
Last active April 5, 2020 09:20
Basic .zshrc for setting up new linux machine
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/tinot/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@vtno
vtno / config.yml
Last active December 2, 2021 14:50
Circle CI 2.1 templates for deploying Ruby on Rails to Heroku with Ruby 2.6.0 and Node. This config deploys `develop` to staging and `master` to production.
version: 2.1
orbs:
heroku: circleci/heroku@0.0.4
references:
container_setup: &container_setup
docker: # run the steps with Docker
- image: circleci/ruby:2.6.0-rc1-node # ...with this image as the primary container; this is where all `steps` will run
environment: # environment variables for primary container
<template>
<button @click='increaseUpdateCount'>{{label}}</button>
</template>
<script>
import { EventBus } from './EventBus.js'
export default {
 props: ['label'],
 methods: {
increaseUpdateCount () {
EventBus.$emit('my-custom-event', 'hello')
/*
In this scenario you could just use `vm.$emit` to communicate to `Container` from `CustomButton.
In reality, this pattern will shine when your component is nested inside some more components and
you can't really emit event to the `Container` quite easily.
*/
<template>
<custom-button label='Click me and the I will update the container state' />
</template>
<script>
import Vue from 'vue'
export const EventBus = new Vue()
// Bind it to click event of that specific button.
const buildFormFromTemplateBtn = (evt: Event,
addBtn: HTMLAnchorElement,
editorIdx: number,
isNewVersion: boolean = false) => {
if (evt.target instanceof window.HTMLAnchorElement) {
// Swap in the time to generate new unique key for a form input.
const time: number = new Date().getTime()
@vtno
vtno / dynamic_form_helper.rb
Created June 26, 2018 05:52
Generate button with html template for dynamic form addition.
# frozen_string_literal: true
module DynamicFormHelper
def link_to_add_association(label, options = {}, partial:, form:, association:, association_type:)
format = options.fetch(:format, '')
new_object = form.object.send(association).klass.new
template_opts = {
locals: {
form: form,
format: format,
@vtno
vtno / circleci-heroku-continuous-deployment2.0.md
Created June 20, 2018 05:28 — forked from lauraturk/circleci-heroku-continuous-deployment2.0.md
instructions for deploying from circleci2.0 to heroku
for f in *.csv; do
mv -- "$f" "${f%.csv}.txt"
done