Skip to content

Instantly share code, notes, and snippets.

View yagamicoder's full-sized avatar
💭
I may be slow to respond.

Michael Gillam yagamicoder

💭
I may be slow to respond.
View GitHub Profile
@yagamicoder
yagamicoder / 0_reuse_code.js
Created September 13, 2016 20:32
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yagamicoder
yagamicoder / main.js
Last active September 23, 2016 02:56
Highlight the current nav link using jQuery
$.each($('#navigation ul li a'), function(event){
var mylink = $(this).attr("href");
var url = window.location;
//If there is a match, apply a class of current, otherwise, remove the class of current
if(url == mylink){
$(this).addClass('current');
}else{
$(this).removeClass('current');
}
@yagamicoder
yagamicoder / nav.css
Last active September 23, 2016 02:55
CSS
#navigation ul li a.current{
background: #A4A4A4;
color: #8A0808;
}
#navigation ul li{list-style: none;}
#navigation ul li a{
background: #585858;
color: #FFF;
@yagamicoder
yagamicoder / index.html
Last active October 20, 2016 12:16
Index
<nav id="navigation">
<ul>
<li><a href="javascript:void(0);">Home</a></li>
<li><a href="javascript:void(0);">About</a></li>
<li><a href="javascript:void(0);">Resume</a></li>
<li><a href="javascript:void(0);">Contact</a></li>
</ul>
</nav>
@yagamicoder
yagamicoder / recent-posts.php
Last active September 23, 2016 02:51
Display most recent posts
<?php
//Pass in recent post settings into $args array
$args = array('numberposts' => 5, 'order' => 'DESC', 'orderby' => 'post_date');
//Grab latest 5 posts
$postslist = get_posts($args);
//Loop through all posts and output the title, date, link to post and excerpt
foreach ($postslist as $post) : setup_postdata($post);
?>
<div class="latest-post">
<a class="latest-title" href="<?php the_permalink(); ?>"title="<?php the_title(); ?>" >
@yagamicoder
yagamicoder / nav.html
Last active September 23, 2016 02:48
Nav menu
<nav id="nav">
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
</ul>
</nav>
@yagamicoder
yagamicoder / first-child.css
Last active September 23, 2016 02:49
First child
#nav ul li:first-child{color: red;}
@yagamicoder
yagamicoder / last-child.css
Last active September 23, 2016 02:49
Last child
#nav ul li:last-child{color: blue;}
@yagamicoder
yagamicoder / main.js
Created September 13, 2016 21:24
Using the stop function to prevent animation queue buildup
$('#boxBtn > a').on('click', function() {
$('#myList').stop(true, true).next("ul").toggle(700);
});
@yagamicoder
yagamicoder / example.js
Created September 23, 2016 00:20
Node.js server running
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Yay, my first node server. Node.js is uber awesome.');
}).listen(9090, '127.0.0.1');
console.log('Server running at http://127.0.0.1:9090/node/');