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
void sort(int values[], int n) | |
{ | |
for (int i = 0; i < n; i++) | |
{ | |
for (int j = 0; j < (n - i - 1); j++) { | |
if (values[j] > values[j + 1]) | |
{ | |
int bubble = values[j]; | |
values[j] = values[j + 1]; | |
values[j + 1] = bubble; |
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
var testArr = [4, 2, 6, 8, 1, 3, 7, 5]; | |
function bubbleSort(arr) { | |
for (let i = 0; i < arr.length; i++) { | |
for (let j = 0; j < arr.length - i - 1; j++) { | |
if (arr[j] > arr[j + 1]) { | |
let bubble = arr[j]; | |
arr[j] = arr[j + 1]; | |
arr[j + 1] = bubble; | |
} |
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
{"lastUpload":"2018-12-04T16:13:28.600Z","extensionVersion":"v3.2.2"} |
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 loadedTabs = {}; // global | |
// call within a function that hsa access to 'tab' permission | |
function load(tabId) { | |
[loadedTabs[tabId]] = response; | |
} | |
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { | |
if ((tabId !== tab.id && loadedTabs[tabId]) || /(chrome)(?:[/:-])/.test(tab.url)) return; | |
if (changeInfo.status === 'complete' && tab.active) { | |
doYourThing(); |
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 utilPages = [ | |
'chrome://extensions/', | |
'chrome://newtab/', | |
'chrome://settings/', | |
'chrome://history/', | |
'chrome://downloads/', | |
'chrome://bookmarks/', | |
'chrome-extension://extensionid/', | |
]; |
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
// Receive unmapped errors object structure. More here: http://vee-validate.logaretm.com/api.html#error-bag | |
function mapFieldToErrorType(unmapped) { | |
const mapped = {}; | |
for (const error in unmapped) { | |
// data-vv-name = error.rule | |
mapped[error] = unmapped[error][0].rule; | |
} | |
return mapped; | |
} |
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
/** | |
* Good article to read what is `@` in `.vue` files | |
* {@link https://www.jerriepelser.com/blog/til-at-symbol-javascript-import/} | |
* | |
* More on `import/no-unresolved` rule: | |
* {@link https://github.com/benmosher/eslint-plugin-import/blob/HEAD/docs/rules/no-unresolved.md#ignore} | |
*/ | |
// `/` is just for sanity and can be ommited. | |
// Add this line to your .eslint.rc |
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
{"lastUpload":"2019-08-02T19:33:43.887Z","extensionVersion":"v3.4.1"} |
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
ZSH_THEME="mh" | |
# If you come from bash you might have to change your $PATH. | |
export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH="/Users/mrv1k/.oh-my-zsh" | |
# Set name of the theme to load --- if set to "random", it will | |
# load a random theme each time oh-my-zsh is loaded, in which case, |
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 MINUTE = 60; | |
const HOUR = MINUTES * 60; | |
const DAY = HOUR * 24; | |
function secondsToTime1(timestamp) { | |
let time = timestamp; | |
const days = Math.floor(time / DAY); | |
time -= days * DAY; | |
const hours = Math.floor(time / HOUR); | |
time -= hours * HOUR; |
OlderNewer