decorators
concerns
Rails features (4 & 5)
Blocks
When to use lambda
package main | |
import "fmt" | |
import "reflect" | |
func contains(val interface{}, array interface{}) (exists bool, index int) { | |
exists = false | |
index = -1 | |
switch reflect.TypeOf(array).Kind() { |
decorators
concerns
Rails features (4 & 5)
Blocks
When to use lambda
Number | Octal | Permission Representation Ref |
---|---|---|
0 | No permission | --- |
1 | Execute permission | --x |
2 | Write permission | -w- |
3 | Execute and write permission: 1 (execute) + 2 (write) = 3 | -wx |
4 | Read permission | r-- |
5 | Read and execute permission: 4 (read) + 1 (execute) = 5 | r-x |
6 | Read and write permission: 4 (read) + 2 (write) = 6 | rw- |
7 | All permissions: 4 (read) + 2 (write) + 1 (execute) = 7 | rwx |
python --version
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
#Simple monkey patch would work | |
module ActiveRecord | |
Base.send :attr_accessor, :_row_ | |
module Associations | |
class JoinDependency | |
JoinBase && class JoinPart | |
def instantiate_with_row(row, *args) | |
instantiate_without_row(row, *args).tap { |i| i._row_ = row } |
If we are working with uuid
(PostgreSQL arrays work with Rails) and you need to compare values in Rails convetion then you may need this.
SASS
for CSS
, CoffeeScript
for JS
, and ERB
for both by default)In order to enable rubocop for your sublime package 3 you first need to make sure the control package of sublime is installed on your sublime package. To check for the control package Way 1: Step 1 -> open sublime package 3 and press ctrl + shift + p wait for some time (hardly 5 seconds) it will open a text field in the sublime package. Step 2 -> Type install if you see Package Control : Install package then the control package is install.
## Show current git branch on terminal | |
#### Add this line of code at the end on file *.bashrc* in Home directory | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[00;31m\]$(__git_ps1)\[\033[00;34m\] \$\[\033[00m\] ' |