Yuto Blog

Yuto Blog

Tag: JavaScript
3 articles
Enable text compression Nginx

Enable text compression Nginx

In Nginx config file :/etc/nginx/sites-enabled/example server { gzip on; gzip_types application/json text/plain text/css application/x-javascript text/xml application/xml application/rss+xml text/javascript application/javascript image/x-icon; Then restart Nginx sudo service nginx restart
Created by Yuto at 2022-02-02 21:44

Ruby on Rails 7 search selectbox with select2 and stimulus

Install select2 and jQuery yarn add select2 jquery Create select2 controller ```app/frontend/controllers/select2_controller.js import { Controller } from "@hotwired/stimulus" import $ from 'jquery'; import 'select2/dist/css/select2.min.css' import Select2 from "select2" export default class extends Controller { connect() { Select2() $('.select2').select2(); } } ``` app/frontend/controllers/index.js import Select2Controller from...
Created by Yuto at 2022-01-26 19:37
【Ruby on Rails】Hướng dẫn làm chức năng sort với jquery-ui sortable

【Ruby on Rails】Hướng dẫn làm chức năng sort với jquery-ui sortable

Cài đặt jQuery và jQuery-ui yarn add popper.js jquery jquery-ui ```javascript:config/webpack/environment.js const { environment } = require('@rails/webpacker') // Add const webpack = require('webpack') environment.plugins.append( 'Provide', new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', Popper: ['popper.js', 'default'] }) ) // Add module.exports =...
Updated by Yuto at 2021-06-18 17:19