This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const axios = require('axios'); | |
const mime = require('mime'); | |
const morgan = require('morgan'); | |
const { URL } = require('url'); | |
const app = express(); | |
const port = process.env.PORT || 80; | |
// app.use(morgan('tiny')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo snap install chromium && sudo snap install code --classic && sudo snap install webstorm --classic && sudo snap install spotify && sudo snap install slack --classic && sudo pt instal nodejs -y && sudo apt install npm -y && sudo apt install git | |
# gestures | |
sudo gpasswd -a $USER input | |
/usr/bin/gnome-session-quit --no-prompt | |
sudo apt-get install libinput-tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getOffset = (element, horizontal = false) => { | |
if(!element) return 0; | |
return getOffset(element.offsetParent, horizontal) + (horizontal ? element.offsetLeft : element.offsetTop); | |
} | |
// calling | |
const someElement = document.getElementById('someElementId'); | |
const X = getOffset(someElement); | |
const Y = getOffset(someElement, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getOffsetTop = element => { | |
let offsetTop = 0; | |
while(element) { | |
offsetTop += element.offsetTop; | |
element = element.offsetParent; | |
} | |
return offsetTop; | |
} | |
// calling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array = [3, 1, 4, 5, 3, 2, 6]; | |
for (i = 0; i < array.length - 1; i++) { | |
let nextMinIndex = i; | |
for (j = i + 1; j < array.length; j++) { | |
// search for the smallest number in the unsorted partition | |
if (array[j] < array[nextMinIndex]) nextMinIndex = j; | |
} | |
if (nextMinIndex != i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array = [3,1,4,5,3,2,6]; | |
for(let i = 1; i < array.length; i++) { | |
let j = i - 1; // array[0...i-1] is sorted | |
let temp = array[i]; | |
while(j >= 0 && array[j] > temp) { | |
array[j+1] = array[j]; | |
j--; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array = [3,1,4,5,3,2,6]; | |
for(let i = 0; i < array.length; i++) { | |
for(j = i + 1; j < array.length; j++) { | |
if(array[i] > array[j]) { | |
// swap | |
const temp = array[i]; | |
array[i] = array[j]; | |
array[j] = temp; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
#include <cmath> | |
using namespace std; | |
int n, i, l; | |
char s[200], cuv[200]; | |
int main() { | |
//cin.getline(cuv, 200); | |
strcpy(cuv, "TPQAREDSXMRYIUVE"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
import urllib.request | |
global x; | |
x=0 | |
def workf(): | |
global x; | |
while True: | |
urllib.request.urlopen('http://') | |
x=x+1 |
NewerOlder