Skip to content

Instantly share code, notes, and snippets.

@MicFin
MicFin / JS
Last active August 29, 2015 14:04
$(function() {
$('.thumbs').on('click', function(e) {
e.preventDefault();
var input = $(this).find('img').attr('src');
var caption = $(this).find('img').data('caption');
var image_html = "<img src='"+input+"'>";
var caption_html = "<section class='caption'>";
caption_html += "<p>"+caption+"</p>";
caption_html += "</section>";
$(function() {
var images = [
{image: "images/dog1.jpg", caption: "caption 1"},
{image: "images/dog2.jpg", caption: "caption 2"},
{image: "images/dog3.jpg", caption: "caption 3"},
{image: "images/dog4.jpg", caption: "caption 4"},
{image: "images/dog5.jpg", caption: "caption 5"},
{image: "images/dog6.jpg", caption: "caption 6"}
];
$(function() {
$('#thumbs a').on('click', function(e) {
e.preventDefault();
$('#thumbs img').css('border', 'none');
$(this).find('img').css('border', 'solid 2px black');
var newSrc = $(this).find('img').attr('src');
$('#fullsize img').attr('src', newSrc);
<!DOCTYPE html>
<html>
<head>
<style>
p.hometown {
background: yellow;
}
.other_town{
background: blue;
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.slide-ruler{
background-color: green;
height: 50px;
width: 500px;
}
.slider{

DO NOT COPY AND PASTE! You must type it all out yourself for this to be valuable. To make sure of that, the "quotation marks" in the code will copy and paste oddly so copy and pasting will not work :) Practice, practice, practice

Let’s create a person in javascript. We could use a variable...

var person = "John Doe";

To print our person’s name we could do...

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">

Lets create a person in javascript. We could use a variable...

var person = "John Doe";

To print our persons name we could do...

var person = "John Doe";
@MicFin
MicFin / game_of_thrones.md
Last active September 17, 2018 00:26
A Variable of Game of Thrones

This is an array called gameOfThonesHouses. It is an array made up of objects. Each object represents a house in the game of thrones. Each house has a name, wikiSuffix, and people. People in a house is an array of objects. Each object represents a person. Each person has a name, description, imageSuffix, and wikiSuffix.

const gameOfThronesHouses = [
    {
      name: "Starks",
      wikiSuffix: "House_Stark",
      people: [
        {
          name: "Eddard \"Ned\" Stark",
// long comprison of each scenario
if (computerSelection === "rock" && userSelection == "scissors") {
console.log("Computer Wins");
} else if (computerSelection === "paper" && userSelection == "rock") {
console.log("Computer Wins");
} else if (computerSelection === "scissors" && userSelection == "paper") {
console.log("Computer Wins");
} else if (computerSelection === "scissors" && userSelection == "rock") {
console.log("User Wins");