Skip to content

Instantly share code, notes, and snippets.

View pondpaun7z's full-sized avatar
🎯
Focusing

Theeraphat Jantakat pondpaun7z

🎯
Focusing
View GitHub Profile
@pondpaun7z
pondpaun7z / typescript-vue.md
Created July 26, 2020 08:39 — forked from RISCfuture/typescript-vue.md
Adding TypeScript to a Rails + Webpacker + Vue project

Adding TypeScript to a Rails + Webpacker + Vue project

These instructions assume you already have a Rails 5.2 project using Webpacker 4 with Vue 2 and Vuex 3. I'll show you how to add TypeScript to the project, and type-safe your Vue components, including single-file components (SFCs). This document will not teach you TypeScript syntax or type theory. It also assumes your code already works without TypeScript. You shouldn't use this article to, for example, get started with Vuex, because I'm leaving out lots of necessary boilerplate code and focusing just on TypeScript changes.

If you want to see a commit on a project accomplishing this migration, visit https://github.com/RISCfuture/AvFacts/commit/666a02e58b4626a074a03812ccdd193a3891a954.

Setup

  1. Run rails webpacker:install:typescript. This should modify config/webpacker.yml and config/webpack/environment.js (leave those changes), add tsconfig.json and config/webpack/loaders/typescript.js (leave those files), and add some other files in `a
@pondpaun7z
pondpaun7z / nginx-tuning.md
Created September 24, 2019 13:14 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@pondpaun7z
pondpaun7z / shadow.xml
Created August 11, 2019 05:09 — forked from lecho/shadow.xml
Android shadow drawable xml.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
#ubuntu 16.04
sudo apt-get update
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev \
libreadline-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev \
postgresql postgresql-contrib aptitude libpq-dev ruby-mini-magick libxml2-dev -y
# install rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
// ปรับให้ Compile ให้ได้ และ console.log ได้ถูกต้อง
let companyName: number = 'Banana Coding';
let companyNumber: boolean = 341.2;
let isDone: boolean = 'true';
const VAT: numbers = 7
const randomNumber: number[] = Math.floor(Math.random() * 6) + 1
getLuckyNumber(companyNumber, VAT, randomNumber) {
return Math.ceil(companyNumber / VAT * randomNumber) + 20;
}
@pondpaun7z
pondpaun7z / sentry.rb
Created April 24, 2019 03:02
config/initializers/sentry.rb
if Rails.env.production?
Raven.configure do |config|
config.dsn = Figaro.env.sentry_dsn
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
config.release = File.open("VERSION").read.chomp
config.environments = %w[staging production]
config.current_environment = Figaro.env.sentry_current_env
end
end
@pondpaun7z
pondpaun7z / no_animations.rb
Created February 28, 2019 04:45 — forked from keithtom/no_animations.rb
Rack Middleware to disable Disable CSS3/jQuery Animations for Capybara
module Rack
# disable CSS3 and jQuery animations in test mode for speed, consistency and avoiding timing issues.
# Usage for Rails:
# in config/environments/test.rb
# config.middleware.use Rack::NoAnimations
class NoAnimations
def initialize(app, options = {})
@app = app
end
Raven.configure do |config|
config.dsn = Figaro.env.sentry_dsn
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
config.release = File.open("VERSION").read.chomp
config.environments = %w[staging production]
config.current_environment = Figaro.env.sentry_current_env
end
@pondpaun7z
pondpaun7z / puma.service
Created November 25, 2018 17:43
Puma auto start with capistrano structure
# /etc/systemd/system/puma.service
# systemctl daemon-reload
# sudo systemctl [start|stop|enable|restart] puma.service
[Unit]
Description=Puma HTTP Server
After=network.target
# Uncomment for socket activation (see below)
# Requires=puma.socket
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff"/>
<stroke android:width="1dp"
android:color="#707070" />
<padding android:left="1dp"
android:top="1dp"
android:right="1dp"