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

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

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

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 ### 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 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

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 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

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