Skip to content

Instantly share code, notes, and snippets.

View sethdavis512's full-sized avatar
🤖

Seth Davis sethdavis512

🤖
View GitHub Profile
@sethdavis512
sethdavis512 / post.md
Last active December 15, 2016 02:38
#post CSS Animations!
View post.md

Simple keyframe animation:

@keyframes jump {
  0%, 100% {
    transform: translateY(0px);
  }
  30% {
    transform: translateY(-30px);
 }
@sethdavis512
sethdavis512 / post.md
Last active May 3, 2016 20:19
#post Find Max/Min Value in Array
View post.md
@sethdavis512
sethdavis512 / remove-duplicate-paths.sh
Created May 7, 2017 18:42
Remove duplicate paths from $PATH
View remove-duplicate-paths.sh
# Taken from https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
if [ -n "$PATH" ]; then
old_PATH=$PATH:; PATH=
while [ -n "$old_PATH" ]; do
x=${old_PATH%%:*} # the first remaining entry
case $PATH: in
*:"$x":*) ;; # already there
*) PATH=$PATH:$x;; # not there yet
esac
View documenting-headings.js
for (var i = 0, headings = $$('h1,h2,h3,h4,h5,h6');
i < headings.length; i++) {
console.log(headings[i].textContent.trim() + " " +
headings[i].tagName,
headings[i]);
}
@sethdavis512
sethdavis512 / simple-vue-w-components.html
Last active August 4, 2017 01:20
Simple Vue.js boilerplate in one file.
View simple-vue-w-components.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Vue</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.5.0/css/bulma.min.css">
<script src="https://unpkg.com/vue"></script>
</head>
<body>
View bulma-vue-single-file.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Vue</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.5.0/css/bulma.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat">
<script src="https://unpkg.com/vue"></script>
<style>
View file-size-documentation.py
import os
import math
import csv
def humanizeFileSize(filesize):
filesize = abs(filesize)
if (filesize==0):
return "0 Bytes"
p = int(math.floor(math.log(filesize, 2)/10))
return "%0.2f %s" % (filesize/math.pow(1024,p), ['Bytes','KB','MB','GB','TB','PB','EB','ZB','YB'][p])
@sethdavis512
sethdavis512 / objectDiff.js
Created September 20, 2017 13:51
Lodash - Find difference between objects
View objectDiff.js
_.reduce(obj1, (result, value, key) => {
const variantValue = obj2[key];
return _.isEqual(value, variantValue) ? result : result.concat(value);
}, []);
View currencyFormatter.js
const formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2,
});
View bulma-blank.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Bulma!</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.0/css/bulma.min.css">
</head>
<body>