Skip to content

Instantly share code, notes, and snippets.

View sethdavis512's full-sized avatar
🤖

Seth Davis sethdavis512

🤖
View GitHub Profile
@sethdavis512
sethdavis512 / Popper.js
Created January 24, 2018 19:25 — forked from ebakan/Popper.js
React Component for Popper.js that takes the reference as its first child and the popper as its second child (a la react-tether)
import React, { Component, PropTypes } from 'react';
import popperJS from 'popper.js';
export default class Popper extends Component {
constructor(props) {
super(props);
this.state = {};
this.update = this.update.bind(this);
}
@sethdavis512
sethdavis512 / visually-hidden.css
Last active March 22, 2018 19:41
Visually hidden to sighted users. Still able to be read by screen readers.
/*
* Hide only visually, but have it available for screen readers:
* https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
*
* 1. For long content, line feeds are not interpreted as spaces and small width
* causes content to wrap 1 word per line:
* https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
*/
.visuallyhidden {
# Safety First
git branch | grep ‘your_string_here’
# Delete'em
git branch | grep 'your_string_here' | xargs git branch -D
# Delete Remote too
git branch | grep ‘your_string_here’ | xargs git push origin — delete
// Avoid "Cannot read property of undefined"
// https://silvantroxler.ch/2017/avoid-cannot-read-property-of-undefined/
export function getSafe(fn) {
try {
return fn();
} catch (e) {
return undefined;
}
}
@mixin transform($property) {
-webkit-transform: $property;
-ms-transform: $property;
transform: $property;
}
.box { @include transform(rotate(30deg)); }
/* ES5, using Bluebird */
var isMomHappy = true;
// Promise
var willIGetNewPhone = new Promise(
function (resolve, reject) {
if (isMomHappy) {
var phone = {
brand: 'Samsung',
color: 'black'
var ageInput = document.getElementById("age")
ageInput.addEventListener("keydown", function(e) {
// prevent: "e", "=", ",", "-", "."
if ([69, 187, 188, 189, 190].includes(e.keyCode)) {
e.preventDefault();
}
})
@sethdavis512
sethdavis512 / diffObjects.js
Created October 11, 2018 17:01
Lodash Diff Objects
import { transform, isEqual, isObject } from 'lodash';
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
return transform(object, (result, value, key) => {
const flattenFilePath = (pathPart, directoryOrFileContents) => {
return Object.entries(directoryOrFileContents).reduce((flattenedFilePaths, [key, value]) => {
if (typeof value === "object") {
Object.assign(flattenedFilePaths, flattenFilePath(`${pathPart}/${key}`, value))
} else {
flattenedFilePaths[`${pathPart}/${key}`] = value
}
return flattenedFilePaths
}, {})
@sethdavis512
sethdavis512 / interview-questions-web-developer.txt
Last active December 20, 2018 17:29
Interview questions to ask a web developer.
Have you worked in an agile or scrum environment? Tell us about your experience.
Have you lead teams before and if so what is your approach to leadership?
What do you expect from a team that you are apart of?
Any experience pair programming?
What is your biggest strength you can contribute to a team?
What is a recent technical challenge you experienced and how did you solve it?
How are you keeping up with the latest developments in web development?
Design vs. Implementation what is your process?