Skip to content

Instantly share code, notes, and snippets.

View saifulapm's full-sized avatar
I may be slow to respond.

Saiful Islam saifulapm

I may be slow to respond.
View GitHub Profile
@saifulapm
saifulapm / Vim_Splits.md
Last active June 16, 2017 21:42
Vim Better Movements

The basics Splits Movement

Create a vertical split using :vsp and horizontal with :sp.

By default, they duplicate the current buffer. This command also takes a filename:

:vsp ~/.vimrc

You can specify the new split height by prefixing with a number:

@saifulapm
saifulapm / vim-cheatsheet.md
Created June 16, 2017 21:44 — forked from 0xadada/README.md
VIM movement, keyboard commands and shortcuts
  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
@saifulapm
saifulapm / Rake Database.md
Created October 17, 2017 22:31 — forked from stevenyap/Rake Database.md
List of rake commands to manage database

Create database

rake db:create

Create database table

This will creates a migration file in /db/migrate without table definition.

rails g migration create_<TABLE>
" For vundle
filetype off
set nocompatible " be iMproved
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#rc()
" Git tools
Bundle 'tpope/vim-fugitive'
" Dependency managment
@saifulapm
saifulapm / download-egghead-io-videos.md
Created June 22, 2018 01:43 — forked from shivamkr19/download-egghead-io-videos.md
Download free egghead.io videos

Download free egghead.io videos

Download Egghead.io videos using Lynx Browser and youtube-dl. This method will only work for videos that do not require a pro account.

Prerequesits

You need a Unix/Linux box with Lynx console browser and Youtube-dl installed.

@saifulapm
saifulapm / UTF8MB4 with Rails fix.md
Last active September 19, 2018 00:31
Specified key was too long; max key length is 767 bytes

I’ve recently received this error when using UTF8MB4 with Rails.

Mysql2::Error: Specified key was too long; max key length is 767 bytes

After finding this issue on the Rails GitHub page, this is the fix:

Create a file called config/initializers/mysql.rb and copy the following into it

@saifulapm
saifulapm / zip.md
Created September 20, 2018 23:22
Making Zip archive in arch linux

How to make zip archive on arch linux

Must Need be Installed zip.. sudo pacman -Syu zip

zip -9 -r <zip file> <folder name>

To zip a single file:

zip -9  
@saifulapm
saifulapm / Setting up ESLint for NextJs.md
Last active March 28, 2023 13:34
Setting up ESLint and Prettier for NextJs

ESLint requires a few additional configurations to be set up optimally for use with Next JS.

To start off with, install eslint, eslint-plugin-react,

npm i --save-dev eslint eslint-plugin-react

Next, create a .eslintrc file using the following:

eslint --init
@saifulapm
saifulapm / nearby-coordinates.sql
Created May 12, 2020 18:11 — forked from statickidz/nearby-coordinates.sql
Ordering with SQL by nearest latitude & longitude coordinates (MySQL & SQLite)
---
METHOD 1
This should roughly sort the items on distance in MySQL, and should work in SQLite.
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance.
---
SELECT *
FROM table
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC