Skip to content

Instantly share code, notes, and snippets.

View j-quelly's full-sized avatar

Jamie Kelly j-quelly

View GitHub Profile
// 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;
}
[
{ "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" },
/* 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)
const TimersDashboard = React.createClass({
getInitialState: function() {
return {
timers: [],
serverError: false,
timerError: false,
};
},
@j-quelly
j-quelly / scrollTo.js
Last active February 5, 2016 01:44 — forked from james2doyle/scrollTo.js
a native scrollTo function in javascript that uses requestAnimationFrame and easing for animation
// 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;