Skip to content

Instantly share code, notes, and snippets.

View primofin's full-sized avatar
πŸš€
If you never try, you’ll never know

Vy Nguyen Thanh primofin

πŸš€
If you never try, you’ll never know
View GitHub Profile
@primofin
primofin / appleAndOrange.js
Created April 5, 2020 13:34
JavaScript: HackerRank Apples and Oranges Tree falling by the house problem
/* https://www.hackerrank.com/challenges/apple-and-orange/problem */
// using filter
function countApplesAndOranges(s, t, a, b, apples, oranges) {
console.log(apples.filter(d => s - a <= d && d <= t - a).length);
console.log(oranges.filter(d => s - b <= d && d <= t - b).length);
}
@primofin
primofin / gradingStudent.js
Last active April 5, 2020 14:06
JavaScript: HackerRank Grading Students
/* https://www.hackerrank.com/challenges/grading/problem */
function gradingStudents(grades) {
// Write your code here
for(let i=0; i< grades.length; i++){
if(grades[i] >= 38 && grades[i]%5 >2) {
grades[i] = grades[i] + (5 - grades[i]%5)
}
}
return grades
@primofin
primofin / kangaroo.js
Created April 5, 2020 14:05
JavaScript: HackerRank Kangaroo
/* https://www.hackerrank.com/challenges/kangaroo/problem */
function kangaroo(x1, v1, x2, v2) {
const numberOfJump = (x2-x1)/(v2-v1)
if(v2 >= v1){
return "NO"
} else if (x1 < x2 && v1 > v2) {
if(Number.isInteger(numberOfJump)){
return "YES"
}else{
return "NO"
@primofin
primofin / breakingRecords.js
Created April 5, 2020 14:50
JavaScript: HackerRank Breaking the Records
/* https://www.hackerrank.com/challenges/breaking-best-and-worst-records/problem */
function breakingRecords(scores) {
let lowestCount = 0
let highestCount = 0
let lowest = scores[0]
let highest = scores[0]
for(let i=1; i< scores.length; i++){
if(scores[i]>highest){
highestCount +=1
@primofin
primofin / sockMerchant.js
Created April 5, 2020 15:50
JavaScript: HackerRank Sock Merchant
/* https://www.hackerrank.com/challenges/sock-merchant */
let pairs = 0
const unpaired = new Set()
for (const color of arr)
if (unpaired.has(color)) {
pairs++
unpaired.delete(color)
} else unpaired.add(color)
//
// ScoreTableViewController.swift
// geoapp
//
// Created by nguyen thanh vy on 25/04/2020.
// Copyright Β© 2020 team geo app. All rights reserved.
//
import UIKit
import Firebase

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@primofin
primofin / gist:a65626c5d809005109eeb92f7072cd6d
Created September 27, 2020 11:51 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@primofin
primofin / iterm2.md
Created November 3, 2020 13:52 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab ⌘ + T
Close Tab or Window ⌘ + W (same as many mac apps)
Go to Tab ⌘ + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction ⌘ + Option + Arrow Key
Cycle iTerm Windows ⌘ + backtick (true of all mac apps and works with desktops/mission control)
@primofin
primofin / activity_main.xml
Created November 6, 2020 14:42
main layout of private keyboard project
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ScrollView