Skip to content

Instantly share code, notes, and snippets.

View 3h5a9's full-sized avatar
🎯
Focusing

3h5a9 3h5a9

🎯
Focusing
View GitHub Profile
@3h5a9
3h5a9 / environment.rb
Created April 30, 2019 14:45
How to remove field_with_errors wrapper in Rails
/*Add the following line of codes into config/environemnt.rb file*/
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
html_tag.html_safe
end
@3h5a9
3h5a9 / .bashrc
Last active May 9, 2019 19:39
Show your branch on Linux Ubuntu terminal
Open up your terminal and type.
nano ~/.bashrc
Now, scroll up to last and paste the code snippet provided below.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
@3h5a9
3h5a9 / index.php
Created July 26, 2019 12:34
hacked
rm -f index.php ; touch index.php; chmod 600 index.php ; ls -l index.php ; cat index.php
rm: cannot remove 'index.php': Permission denied
touch: cannot touch 'index.php': Permission denied
chmod: changing permissions of 'index.php': Operation not permitted
-r--r--r-- 1 www-data www-data 115811 Jun 21 2018 index.php
<?php
$OO0_0O_0O_='BEGINJ6Pn2HmH0e568SXnR6KRkmP5tQbh7KEW';
$O_O0_O0_0O='benzylpenicillin455989';
$O0_O00O__O=407;
$OOO_O_00_0='E/B/D_C/F';
@3h5a9
3h5a9 / rfs.scss
Created August 4, 2019 19:59
Bootstrap responsive font size scss
@media (max-width: 1200px) {
legend {
font-size: calc(1.275rem + 0.3vw);
}
h1,
.h1 {
font-size: calc(1.375rem + 1.5vw);
}
h2,
.h2 {
```
ActionController::RoutingError (No route matches [GET] "/assets/typed.min.js.map"):
actionpack (5.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.2.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.3) lib/rails/rack/logger.rb:38:in `call_app'
@3h5a9
3h5a9 / error
Last active August 23, 2019 21:30
Ruby on rails execjs runtime error!
00:31 bundler:install
The Gemfile's dependencies are satisfied, skipping installation
00:32 deploy:assets:precompile
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
01 yarn install v1.15.2
01 [1/4] Resolving packages...
01 [2/4] Fetching packages...
01 [3/4] Linking dependencies...
01 [4/4] Building fresh packages...
01 success Saved lockfile.
@3h5a9
3h5a9 / comments_controller.rb
Created May 4, 2020 08:55
Nested Comment wrong redirection.
class CommentsController < ApplicationController
before_action :find_commentable, only: %i[new create destroy]
def new
@comment = Comment.new
end
def create
@comment = @commentable.comments.new(comment_params)
if @comment.save
@3h5a9
3h5a9 / MySql-5.5-installation guide.md
Created September 28, 2020 21:18 — forked from ahmadhasankhan/MySql-5.5-installation guide.md
Install MySQL 5.5.xx on Ubuntu

MySQL Download URL

https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

Open the terminal and follow along:

  • Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R
@3h5a9
3h5a9 / mysqlshortcut.txt
Last active October 8, 2020 14:08
Mysql Showrtcut for Linux (Ubuntu)
mysql -u root -p //enter into mysql as root user
SHOW DATABASES; //Show available databases
DROP DATABASE database_name; //Delete a mysql database
sudo /etc/init.d/mysql.server start //start mysql server
sudo /etc/init.d/mysql.server stop //Stop mysql server
@3h5a9
3h5a9 / ubuntu.txt
Last active September 3, 2021 17:49
Necessary things to do in newly installed Ubuntu (20.04)
/******************************
Update and Upgrade Ubuntu
******************************/
sudo apt update && sudo apt upgrade -y
/******************************
Necessarry Ubuntu Tools
******************************/
1] Tweak-Tool [sudo apt install gnome-tweak-tool]