Skip to content

Instantly share code, notes, and snippets.

View MinSomai's full-sized avatar
🇳🇵
from the land of Mountains, Nepal. Namaste!

Min Somai MinSomai

🇳🇵
from the land of Mountains, Nepal. Namaste!
View GitHub Profile
package hw;
import java.awt.*;
import java.applet.*;
public class Oval13 extends Applet {
public void init() {
setBackground(Color.YELLOW);
setForeground(Color.GREEN);
}
public void paint(Graphics g) {
package hw;
import java.awt.*;
import java.applet.*;
public class Rectangle13 extends Applet{
public void init()
{
setBackground(Color.white);
setForeground(Color.green);
}
@MinSomai
MinSomai / _breakpoint-mixins.scss
Last active March 20, 2020 18:26
Mixins for Breakpoint, SASS.
@mixin only-for-mobile {
@media (max-width: 576px) {
@content;
}
}
@mixin mobile-and-above {
@media (min-width: 576px) {
@content;
}
@MinSomai
MinSomai / .vimrc
Last active April 20, 2020 15:42
FrontEnd .vimrc 2020
"" Vim commands e: $MYVIMRC
" Not compatible with vi
set nocompatible " required
filetype off " required
" ---------- VUNDLE -----------
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"call vundle#begin('~/some/path/here')
@MinSomai
MinSomai / Basic Algorithm Scripting: Chunky Monkey.js
Last active May 29, 2020 06:35
Basic Algorithm Scripting: Chunky Monkey
function chunkArrayInGroups(arr, size) {
let newArr = [];
let arrLength = arr.length;
let lastVal = arrLength % size;
let canDo = parseInt(arrLength / size);
let sliceStart = 0;
let sliceEnd = size;
@MinSomai
MinSomai / Intermediate Algorithm Scripting: Sum All Numbers in a RangePassed.js
Created May 28, 2020 16:54
Intermediate Algorithm Scripting: Sum All Numbers in a RangePassed
function sumAll(arr) {
let sortedArr = arr.sort((a, b)=>a-b);
let sum = sortedArr[0] + sortedArr[1];
for(let i = sortedArr[0]+1; i< sortedArr[1]; i++){
sum+= i;
}
return sum;
@MinSomai
MinSomai / Intermediate Algorithm Scripting: Diff Two Arrays.js
Created May 28, 2020 17:13
Intermediate Algorithm Scripting: Diff Two Arrays
function diffArray(arr1, arr2) {
let first = checkOnce(arr1, arr2);
let second = checkOnce(arr2, arr1);
return first.concat(second);
}
function checkOnce(arr1, arr2){
let unique = [];
@MinSomai
MinSomai / Intermediate Algorithm Scripting: Seek and Destroy.js
Created May 29, 2020 06:34
Intermediate Algorithm Scripting: Seek and Destroy
function destroyer(arr, ...rest) {
let newArray = [...arr];
rest.forEach(item=>{
while(newArray.includes(item)){
newArray = deleteIfFound(arr, item);
}
})
@MinSomai
MinSomai / Intermediate Algorithm Scripting: Wherefore art thou.js
Created May 29, 2020 10:59
Intermediate Algorithm Scripting: Wherefore art thou
function whatIsInAName(collection, source) {
var arr = [];
let matchingIndex = [];
collection.forEach((obj, index)=>{
let matchBool = matchesSource(obj, source);
if(matchBool)
matchingIndex.push(index);
});
@MinSomai
MinSomai / Intermediate Algorithm Scripting: Spinal Tap Case.js
Created May 29, 2020 11:47
Intermediate Algorithm Scripting: Spinal Tap Case
function spinalCase(str) {
let reg = /([A-Z]*[a-z]+)/g;
let result = [];
str.match(reg).forEach(item=>{
result.push(item.toLowerCase());
})
return result.join("-");