Skip to content

Instantly share code, notes, and snippets.

View ing-arriola's full-sized avatar
💭
Always learning, Always Growing, Always thriving 🥳

Jaime Arriola ing-arriola

💭
Always learning, Always Growing, Always thriving 🥳
View GitHub Profile
1. Open your terminal
#In step 2, you can use your favorite editor instead of nano
2. sudo nano ~/.bashrc
3. Go to the end of your .bashrc file
4. Add these lines in your .bashrc file
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
@ing-arriola
ing-arriola / useOfSplit2.js
Created March 11, 2020 16:02
split a string and retrieves an array
//The user enter a string and as a result gets an array
function stringToArray(){
let stringFromUser="firstname,secondname,surname,lastname"
let collectionOfCharacters=stringFromUser.split(",")
alert(`The result array is: ${collectionOfCharacters}`)
}
@ing-arriola
ing-arriola / stringsFunctionsP1.js
Last active March 11, 2020 15:59
Examples of split function
//The user enter a string and as a result gets an array
function stringToArray(){
let stringFromUser="this string"
let collectionOfCharacters=stringFromUser.split("")
alert(`The result array is: ${collectionOfCharacters}`)
}
@ing-arriola
ing-arriola / Strings3.js
Created January 12, 2020 20:40
Ilustrates the concatenation of Strings
const updateElementsOnDOM= (elementModified)=>{
document.getElementById(elementModified.name+"-item").value=elementModified.amount
}
@ing-arriola
ing-arriola / strings2.js
Created December 26, 2019 00:18
example of lenght in Strings
let password=""//Declare and initiallize the variable
//Let's say that get a password from a prompt is a good idea... just for demonstrate the use of lenght
password=prompt("Insert you password, it must have at least 5 characters")//Ask the user for the password
if(password.length>=5){//Validation of password lenght
alert("password set successfully!!")//Suppose that in addition to show message we store it in a DB
}else{
alert("The password must have at least 5 characters")//The password is not the required... the the system should ask it again
}
@ing-arriola
ing-arriola / strings1.js
Last active December 25, 2019 22:48
Example of strings declarations
let message="Hello this is a string"//You can declare a String using double quotes
let greeting='Good morning!'//Also you can declare a String using sigle quotes
@ing-arriola
ing-arriola / variables4.js
Last active December 23, 2019 03:14
Differents way of naming a large variables
let listOfCostumers=[]//This one is called Camell Case; as you can see the all the letters of the
//first word are lower case but the first letter of the following
//words begins with upperCase
let list_of_products=[]//This one is called under_score because you use "_" to separate
//each word of the name
let FirstNameOfCustomer="John"//This one is called Pascal Case, in this form you write
//the first letter of each word as UperCase
@ing-arriola
ing-arriola / variables3.js
Created December 22, 2019 20:42
constant declaration using const
let a=6
if(a>5){
const local="local variable"
console.log(local)
local="other value"//Trying to set the constant to anothe value... but this fails :O
}
console.log(local)//This throw an error because the scope of const is the same of let
@ing-arriola
ing-arriola / variables2.js
Last active December 22, 2019 20:26
var declaration using var
let a=6
if(a>5){
var local="local variable"
console.log(local)//This will print the value "local variable"
}
console.log(local)//This will print the value "local variable" with no one error
@ing-arriola
ing-arriola / variables1.js
Last active December 22, 2019 19:28
Var declaration in JS
let a=6
if(a>5){
let local="local variable"
console.log(local)//This will print the value "local variable"
}
console.log(local)//This will throw an error because local is out of scope