Skip to content

Instantly share code, notes, and snippets.

View jhadeepakkumar14's full-sized avatar

Deepak Kumar Jha jhadeepakkumar14

View GitHub Profile
@jhadeepakkumar14
jhadeepakkumar14 / bootstrap-in-rails
Last active May 27, 2017 04:34
How to add Bootstrap in Ruby on Rails App
1. Add following gems in Gemfile
gem 'bootstrap-sass', '~>3.3.6'
gem 'autoprefixer-rails', '~>7.1.1'
2. Run bundle install
3. Add one file custom.css.scss file under app/assets/stylesheets with following contents,
@import 'bootstrap-sprockets';
@import 'bootstrap'
@jhadeepakkumar14
jhadeepakkumar14 / guard-rails
Created June 10, 2017 15:12
guard-in-rails
1. Add following gem to development group of Gemfile
gem 'guard', '~> 2.14.0'
gem 'guard-rspec', '~> 4.7.2'
gem 'guard-cucumber', '~> 2.1.2'
2. Run the following command to install the gems:
bundle install
3. Also run the command:
guard init
Solution1:
Let's say we want to ignore build folder from all other branch except production branch . As we want to push build folder in production.
1) Dont include build in .gitignore . If you do that it will always be ignored for all branches .
2) Create a file exclude_from_public_viewing inside ./.git/info (This folder already exists) folder touch ./.git/info/exclude_from_public_viewing
3) Inside exclude_from_public_viewing write one line (As you are trying to ignore build for all the branches). !build
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@jhadeepakkumar14
jhadeepakkumar14 / multi-git.md
Created April 2, 2018 17:28 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

@jhadeepakkumar14
jhadeepakkumar14 / dump.txt
Created April 2, 2018 18:14 — forked from rosswd/dump.txt
Database dumps
https://en.wikipedia.org/wiki/Wikipedia:Database_download
https://archive.org/details/stackexchange
http://www.imdb.com/interfaces
https://dmoztools.net/docs/en/rdf.html
https://www.cia.gov/library/publications/the-world-factbook/
https://www.rfc-editor.org/retrieve/
http://download.geonames.org/export/
https://www.census.gov/main/www/cen2000.html
https://www.census.gov/population/www/cen2000/briefs/
http://ucdata.berkeley.edu/index.php
@jhadeepakkumar14
jhadeepakkumar14 / users.sql
Created April 2, 2018 18:15 — forked from rosswd/users.sql
Managing users in MySQL
-- start mysql daemon
mysql.server start
-- connect as root
mysql -u root -p
-- create a new limited user
-- [field] = placeholder for your situation
CREATE USER '[username]'@'localhost' IDENTIFIED BY '[password]';
GRANT SELECT, INSERT, UPDATE, ALTER ON *.* TO '[username]'@'localhost';
@jhadeepakkumar14
jhadeepakkumar14 / ImageUploadComponent.jsx
Created April 6, 2018 06:00 — forked from hartzis/ImageUploadComponent.jsx
React Image Uploading Component with Image Preview
class ImageUpload extends Component {
constructor(props) {
super(props);
this.state = {
file: '',
imagePreviewUrl: ''
};
this._handleImageChange = this._handleImageChange.bind(this);
this._handleSubmit = this._handleSubmit.bind(this);
}
@jhadeepakkumar14
jhadeepakkumar14 / postgres-cheatsheet.md
Created April 12, 2018 17:02 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
ps aux | grep -ie rake | awk '{print $2}' | xargs kill -9
ps aux | grep -ie delayed_job | awk '{print $2}' | xargs kill -9