Skip to content

Instantly share code, notes, and snippets.

View mattmawhinney's full-sized avatar

Matt Mawhinney mattmawhinney

View GitHub Profile
@mattmawhinney
mattmawhinney / gist:d77c8ec16c4989f823eb50d7ade21660
Created January 19, 2018 11:57
Custom Code for Google Sheets Function
function corSPLIT(input) {
function splitValue(value, index) {
//console.log(value.substring(0, index+1) + "#" + value.substring(index+1));
return value.substring(0, index+1) + "#" + value.substring(index+1);
}
var corNumA = input.split("");
//console.log(corNumA);
# http://www.rubeque.com/problems/reverse-each-word
# http://ruby-doc.org/core-2.0/Enumerable.html#method-i-inject
# After some refactoring both these methods work!
# Both use Enumerable#inject; however, the first removes the unecessary ' ' at the end of the string
# using string substitution, while the second uses a conditional to prevent the space from ever being added
def reverse_each_word(sentence)
@mattmawhinney
mattmawhinney / navbarwdropdown.css
Last active December 19, 2015 14:19
CSS for turning a list item in an unordered list into a drop down menu
div {
border-radius: 5px;
}
#header {
z-index: 1;
position: fixed;
width: 99.0%;
margin-top: -20px;
height: 60px;
@mattmawhinney
mattmawhinney / navbarwdropdown.html
Created July 10, 2013 18:31
HTML for navbar with a drop down menu built in
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="navbarwdropdown.css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type='text/javascript' src='script.js'></script>
</head>
<body>
<div id="header">
$(document).ready(function () {
$('#blogs').hover(
function () {
//show its submenu
$('ul', this).stop().slideDown(400);
},
function () {
//hide its submenu
$('ul', this).stop().slideUp(200);
}
@mattmawhinney
mattmawhinney / navbarwicon.html
Created July 9, 2013 21:21
Navbar with icon that shows up in Chrome and Firefox
<!--<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="navbar.css"/> -->
<title>Hello, I'm Matt Mawhinney!</title>
<link rel="shortcut icon" href="https://lh6.googleusercontent.com/-oSPgrfaAA4w/Uc3azyCxwwI/AAAAAAAAAS4/PoZnAVzly6w/s64-no/red_head.ico" />
<!--</head>
<body>
<div id="header">
<ul id="nav">
@mattmawhinney
mattmawhinney / navbar.css
Last active December 19, 2015 13:19
Styling for personal homepage navbar
div {
border-radius: 5px;
}
#header {
z-index: 1;
position: fixed;
width: 99.0%;
margin-top: -20px;
height: 60px;
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="navbar.css"/>
</head>
<body>
<div id="header">
<ul id="nav">
<a href="http://www.mattmawhinney.com"><li>Home</li></a>
<a href="https://www.linkedin.com/pub/matt-mawhinney/1a/238/176/" target="blank"><li>LinkedIn</li></a>
@mattmawhinney
mattmawhinney / separate_comma.rb
Created June 19, 2013 19:03
A method to insert commas into numbers that are 4 digits or longer. An exercise in using regular expressions.
def separate_comma(number)
number.to_s.gsub(/(\d)(?=(\d{3})+$)/, '\1,')
end
@mattmawhinney
mattmawhinney / Account.rb
Created June 18, 2013 22:27
More Ruby practice from Codeacademy working on using private methods
class Account
attr_reader :name
attr_reader :balance
def initialize(name, balance = 100)
@name = name
@balance = balance
end