This file contains hidden or 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
// get element Y position | |
function elmYPosition(eID) { | |
var elm = document.getElementById(eID), | |
y = elm.offsetTop - 65, | |
node = elm; | |
while (node.offsetParent && node.offsetParent != document.body) { | |
node = node.offsetParent; | |
y += node.offsetTop; | |
} | |
return y; |
This file contains hidden or 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 TimersDashboard = React.createClass({ | |
getInitialState: function() { | |
return { | |
timers: [], | |
serverError: false, | |
timerError: false, | |
}; | |
}, |
This file contains hidden or 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
/* eslint-disable no-console */ | |
/* eslint-disable no-undef */ | |
window.client = (function() { | |
function getTimers(success, onError) { | |
return fetch('/api/timers', { | |
// tell the server we'll only accept a JSON response | |
headers: { | |
Accept: 'application/json', | |
}, | |
}).then(checkStatus) |
This file contains hidden or 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
[ | |
{ "keys": ["ctrl+shift+n"], "command": "new_window" }, | |
{ "keys": ["ctrl+shift+w"], "command": "close_window" }, | |
{ "keys": ["ctrl+o"], "command": "prompt_open_file" }, | |
{ "keys": ["ctrl+shift+t"], "command": "reopen_last_file" }, | |
{ "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} }, | |
{ "keys": ["ctrl+n"], "command": "new_file" }, | |
{ "keys": ["ctrl+s"], "command": "save" }, | |
{ "keys": ["ctrl+shift+s"], "command": "prompt_save_as" }, | |
{ "keys": ["ctrl+f4"], "command": "close_file" }, |
This file contains hidden or 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
// passing 100% of tests | |
function getStartPosition(m) { | |
let position = ''; | |
m.forEach((row, x) => { | |
const cells = row.split(''); | |
const y = cells.indexOf('*'); | |
if (y !== -1) { | |
position += x + ','; | |
position += y; | |
} |
This file contains hidden or 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
// Definition for singly-linked list: | |
// function ListNode(x) { | |
// this.value = x; | |
// this.next = null; | |
// } | |
// | |
function getNumber(list) { | |
let current = list; | |
let num = []; |
This file contains hidden or 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
// Definition for singly-linked list: | |
// function ListNode(x) { | |
// this.value = x; | |
// this.next = null; | |
// } | |
// | |
function mergeTwoLinkedLists(l1, l2) { | |
const list = []; | |
let left = l1; | |
let right = l2; |
This file contains hidden or 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
// Definition for singly-linked list: | |
// function ListNode(x) { | |
// this.value = x; | |
// this.next = null; | |
// } | |
// | |
function reverseNodesInKGroups(l, k) { | |
let temp = k; | |
let current = l; | |
const results = []; |
This file contains hidden or 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
// Definition for singly-linked list: | |
// function ListNode(x) { | |
// this.value = x; | |
// this.next = null; | |
// } | |
// | |
function getArryFromList(l) { | |
let current = l; | |
const results = []; | |
while(current) { |
This file contains hidden or 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
function groupingDishes(dishes) { | |
const ingredientMap = dishes.reduce((map, dish) => { | |
dish.slice(1).forEach((ingredient) => { | |
if (!map[ingredient]) { | |
map[ingredient] = [dish[0]]; | |
} else { | |
// if happens more than once it should be an ingredient | |
map[ingredient].push(dish[0]); | |
} | |
}); |
OlderNewer