Skip to content

Instantly share code, notes, and snippets.

View mikemcbride's full-sized avatar
🍪
accepting cookies

Mike McBride mikemcbride

🍪
accepting cookies
View GitHub Profile
@mikemcbride
mikemcbride / getObjectIndex.js
Created June 6, 2016 18:02
Get the index of an object in an array based on a property
function getObjectIndex (array, key, term) {
return array.indexOf(array.find(it => it[key] === term))
}
// Example: find the index of the object where object.foo == 'apple'
const myArray = [
{
'foo': 'foo',
'bar': 'bar',
'baz': 'baz'
@mikemcbride
mikemcbride / annoying CSS background animation
Created March 29, 2016 03:17
Super annoying CSS background color animation
// for fun
// add the "annoying" class to anything to give your friends a seizure.
// see it in action:
// http://codepen.io/mmcbride1007/pen/QNMWpe
.annoying {
animation: pulse .2s infinite;
}
@keyframes pulse {