Skip to content

Instantly share code, notes, and snippets.

View adamdehaven's full-sized avatar

Adam DeHaven adamdehaven

View GitHub Profile
<svg class="logo" viewBox="0 0 196 50" width="196px" height="100%" preserveAspectRatio="xMinYMin meet">
<title>Image Title</title>
<switch>
<use xlink:href="#khat-logo"></use>
<foreignObject>
<img class="logo" alt="KHAT logo" src="~/Content/images/logo.png" />
</foreignObject>
</switch>
</svg>
@adamdehaven
adamdehaven / arrow.scss
Created March 1, 2017 15:14
Create an arrow in Sass and place on element.
// Add dropdown to multiselect elements
.k-multiselect {
position: relative;
&:after {
content: " ";
width: 0;
height: 0;
position: absolute;
top: 45%;
@adamdehaven
adamdehaven / cookies.js
Created February 27, 2017 14:02
Create, read, and destroy cookies with javascript
/**
* Cookie functions
*/
function createCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
@adamdehaven
adamdehaven / slack.sh
Last active December 6, 2017 14:00
bash function to post to Slack
#/bin/bash
posttoslack() {
# Prompt user for Slack #channel or @username
while true; do
read -p "#
# Post to channel or username: " "CHANNEL"
case "$CHANNEL" in
[\#\@][[:lower:]-_]* ) eval SUCCESSMESSAGE="$CHANNEL"; eval CHANNEL='\"channel\":"\"$CHANNEL\"",'; break;;
@adamdehaven
adamdehaven / .gitconfig
Created May 17, 2016 16:06 — forked from rab/.gitconfig
A good starting point for ~/.gitconfig
# -*- Conf -*-
[color]
branch = auto
diff = auto
status = auto
showbranch = auto
ui = true
# color.branch
# A boolean to enable/disable color in the output of git-branch(1). May be set to always, false (or
@adamdehaven
adamdehaven / network-connectivity.sh
Created April 27, 2016 19:45
Bash/Terminal check if a URL can be reached via cURL
#!/bin/bash
case "$(curl -s --max-time 2 -I $1 | sed 's/^[^ ]* *\([0-9]\).*/\1/; 1q')" in [23]) echo "HTTP connectivity is up";; 5) echo "The web proxy will not let us through";; *) echo "The network is down or very slow";; esac
### Run
# $ bash network-connectivity.sh http://google.com/
### Result
# $ HTTP connectivity OK
@adamdehaven
adamdehaven / http-status.sh
Last active April 27, 2016 19:46
Bash/Terminal to return the HTTP status code of a URL via cURL. Includes following redirects to final URL
#!/bin/bash
status=$(curl $1 -s -L -I -o /dev/null -w '%{http_code}')
echo $status
### Run
# $ bash http-status.sh http://google.com/
/* =============================================================================
CSS Declarations
========================================================================== */
/* ==|== The Standard Way =================================================== */
.foo::before {
/* ...css rules... */
}
@adamdehaven
adamdehaven / sjbpost.txt
Last active November 18, 2020 00:09
SJBpost() Command/Event Names in Google Play Music
"addAlbumMenus",
"addFreeSongs",
"addPlaylistMenus",
"addSongListToCache",
"addSongsToPlaylist",
"addSongToList",
"addSongToList",
"addToAnimation",
"albumDeleted",
"albumDeleted",
@adamdehaven
adamdehaven / bgimage.css
Last active September 19, 2024 13:29
Bootstrap full-width hero section with text and image
.bgimage {
width:100%;
height:500px;
background: url('https://images.unsplash.com/photo-1438109491414-7198515b166b?q=80&fm=jpg&s=cbdabf7a79c087a0b060670a6d79726c');
background-repeat: no-repeat;
background-position: center;
background-size:cover;
background-attachment: fixed;
}
.bgimage h5 {