Rails 7 with React, TailwindCSS and Bootstrap 5 Example December 21, 2021 | admin Rails 7 with React, TailwindCSS and Bootstrap 5 Example – Rails 7.0.0 – SQLite – Node v14.15.0 – NPM 6.14.8 – Yarn 1.22.17 – TailwindCSS 3 – Bootstrap 5 – React 17.0.2 Setup Rails 7 project Create Rails 7 project rails _7.0.0_ new Rails7WithReactTailwindCSSBootstrapExample -j esbuild -c tailwind Install node packages yarn add @tailwindcss/forms @tailwindcss/typography… Read More
Customize view scaffolding template using Bootstrap 5 January 13, 2021 | Tam Nguyen Rails Custom View Scaffold Example Customize view scaffolding template using Bootstrap 5 We will do in this example: – Create new new the Ruby on Rails project using version 6.1.1 – Locate Railties path – Customize the scaffold template – Add Boostrap version 5.0.0-beta1 – Generate scaffold for category and article – Run project and… Read More
[SOLVED] the fan running at high speeds, kernel task taking up 500% cpu (high cpu) on macbook August 2, 2018 | Tam Nguyen These are my problem on macbook pro 15″, mid 2015: – macOS running very slow – fan running high – kernel_task taking up to 500% CPU And I fixed my macbook as following steps: Step 1: Disable SIP Enter recovery mode – Shutdown your macbook – Press keys: Command + R – Press power button… Read More
Regex Match all characters between two html tags April 5, 2017 | Tam Nguyen Regex Match all characters between two strings Syntax: (?<=beginningstringname)(.*\n?)(?=endstringname) Example: Write Regex Match all characters between two html tags regular expression: (?s)(?<=\<span class=\”highlight highlight–wrapping\”\>)(.*?)(?=\<\/span\>) in a html string <div>… <span class=”highlight highlight–wrapping”>Chuck</span> <span class=”highlight highlight–wrapping”>Feeney</span> (David Cantwell for Forbes) On a cool summer afternoon at Dublin’s Heuston Station, <span class=”highlight highlight–wrapping”>Chuck</span> <span class=”highlight highlight–wrapping”>Feeney</span>, 81…<br>… Read More
Add Material-UI to Next.js 2 April 5, 2017 | Tam Nguyen Next.js 2 with Material-UI Example Init node project mkdir nextjs-material-ui-example && cd nextjs-material-ui-example npm init -y npm i -S next react react-dom material-ui react-tap-event-plugin with structure files: . ├── LICENSE ├── README.md ├── package.json └── pages └── index.js Add script to package.json “scripts”: { “dev”: “next”, “build”: “next build”, “start”: “next start”, “test”: “echo \”Error:… Read More
Highlighting text in Ruby April 4, 2017 | Tam Nguyen Highlighting text in Ruby ### Start code def highlight(text,search_string) keywords = search_string.squeeze.strip.split(” “).compact.uniq matcher = Regexp.new( ‘(‘ + keywords.join(“|”) + ‘)’ ) highlighted = text.gsub(matcher) { |match| “<b>#{match}</b>” } return highlighted end text = “This is an example of the text.” search = “example text” puts highlight(text,search) # => This is an <b>example</b> of the… Read More
Remove all node_module folders recursively March 28, 2017 | Tam Nguyen Remove all node_module folders recursively find . -name “node_modules” -exec rm -rf ‘{}’ + That will delete the folder and files even if there is a space in the name. That saved me about 10GB over several hundred node projects which I had not touched in a while. If I need the node modules back,… Read More
Create upstart script for DeepDetect March 23, 2017 | Tam Nguyen Upstart script for DeepDetect Create upstart config /etc/init/deepdetect.conf description “DeepDetect” start on filesystem or runlevel [2345] stop on run level [!2345] respawn respawn limit 3 12 script exec /usr/bin/deepdetect.sh end script pre-start script echo “command_deepdetect_starting START : $(date)” >> /var/log/deepdetect.log end script pre-stop script rm /var/run/command_deepdetect_starting.pid echo “command_deepdetect_starting STOP : $(date)” >> /var/log/deepdetect.log end script… Read More
Install Squid proxy server on Ubuntu 14.04 March 19, 2017 | Tam Nguyen Install Squid proxy server on Ubuntu 14.04 Installing Squid Squid is available in the Ubuntu repositories. To ensure your system is up to date and then to install Squid, run the following commands: sudo apt-get update sudo apt-get upgrade sudo apt-get install squid Copy the original configuration file to keep as a backup: sudo cp… Read More
[DeepLearning] Write a simple Rails API to predict a image use DeepDetect March 11, 2017 | Tam Nguyen DeepDetect Client Rails Example Requirements Ubuntu 14.04 or Ubuntu 16.04 Rails 5+ Ruby 2.2+ Redis Install DeepDetect Install dependencies: sudo apt-get install build-essential libgoogle-glog-dev libgflags-dev libeigen3-dev libopencv-dev libcppnetlib-dev libboost-dev libboost-iostreams-dev libcurlpp-dev libcurl4-openssl-dev protobuf-compiler libopenblas-dev libhdf5-dev libprotobuf-dev libleveldb-dev libsnappy-dev liblmdb-dev libutfcpp-dev cmake libgoogle-perftools-dev unzip Clone & build deepdetect: cd && mkdir Projects && git clone git@github.com:beniz/deepdetect.git… Read More