Skip to content

Instantly share code, notes, and snippets.

View AshikNesin's full-sized avatar

Ashik Nesin AshikNesin

View GitHub Profile
@AshikNesin
AshikNesin / rails-skip.md
Created September 10, 2015 11:28
Rails generator controller without tests, assets & helpers

Configuring application.rb

To turn off without having to add options:

# application.rb
config.generators.assets = false
config.generators.helper = false

While Generating Controller

@AshikNesin
AshikNesin / some-name.erb.html
Created September 10, 2015 17:32
[Rails] Show Month Combo box in view
<%= f.select :month, options_for_select([["January", "1"], ["February", "2"], ["March", "3"],["April", "4"], ["May", "5"], ["June", "6"], ["July", "7"], ["August", "8"], ["September", "9"], ["October", "10"], ["November", "11"], ["December", "12"]]) %>
@AshikNesin
AshikNesin / zip-archieve.md
Created September 11, 2015 11:14
How to zip archive all files in current directory via Terminal

To Archive all files including hidden files

zip -r file_name.zip .

To Archive all files without hidden files

zip -r file_name.zip . -x ".*" -x "*/.*"

@AshikNesin
AshikNesin / wp-permission-fix.md
Last active September 11, 2015 13:43
[Fix] Can't get wordpress to write the wp-config.php file

Just go to wordpress installation directory inside your www directory in terminal and give write permission to your web server which is running as www-data

sudo chown -R www-data wordpress

via StackExchange

@AshikNesin
AshikNesin / git-change-url.md
Last active September 16, 2015 08:06
[Git] Changing a remote's URL of Git

Here's command to do it

git remote set-url origin git://new.url.here

Like this

git remote set-url origin https://ashiknesin@github.com/HugeThoughts/simple-payroll.git

@AshikNesin
AshikNesin / rails-combo.md
Last active September 16, 2015 09:33
[Rails] Retrieve from database and populate it to combo box

Basically we are going to retrieve the details from database (in my case its employee name & their number) and assign it to an array.

Then we populate that array to the select

# /app/views/payslips/index.html.erb
<% emp_array = Employee.all.map { |emp| [emp.name, emp.emp_no] } %>
<%= f.select :emp_no, options_for_select(emp_array) %> 
@AshikNesin
AshikNesin / html-style-guide.md
Created September 23, 2015 05:45 — forked from heiswayi/html-style-guide.md
HTML style guide with coding standards and best practices.

HTML Style Guide

All rules and guidelines in this document apply to HTML files.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Icon Legend:

· Space, Tab, Enter/Return

@AshikNesin
AshikNesin / css-style-guide.md
Created September 23, 2015 05:45 — forked from heiswayi/css-style-guide.md
CSS style guide with coding standards and best practices.

CSS Style Guide

All rules and guidelines in this document apply to css/scss files unless otherwise noted.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@AshikNesin
AshikNesin / javascript-style-guide.md
Created September 23, 2015 05:46 — forked from heiswayi/javascript-style-guide.md
JavaScript style guide with coding standards and best practices.

JavaScript (jQuery) Style Guide

All rules and guidelines in this document apply to jQuery files unless otherwise noted.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@AshikNesin
AshikNesin / sed-append.md
Created September 27, 2015 14:31
Append to last line using sed
sed -i -e '$a\Hello World' filename