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 May 3, 2016 20:19
#post Find Max/Min Value in Array
@sethdavis512
sethdavis512 / post.md
Last active December 15, 2016 02:38
#post CSS Animations!

Simple keyframe animation:

@keyframes jump {
  0%, 100% {
    transform: translateY(0px);
  }
  30% {
    transform: translateY(-30px);
 }
@sethdavis512
sethdavis512 / remove-duplicate-paths.sh
Created May 7, 2017 18:42
Remove duplicate paths from $PATH
# 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
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]);
}
<!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>
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
_.reduce(obj1, (result, value, key) => {
const variantValue = obj2[key];
return _.isEqual(value, variantValue) ? result : result.concat(value);
}, []);
function getSafe(fn) {
try {
return fn();
} catch (e) {
return undefined;
}
}
getSafe(() => obj.a.lot.of.properties);
<!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>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React Template</title>
<style>
body {
font-family: sans-serif;
font-weight: 100;
}