This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import for react only | |
//import fetch from 'isomorphic-fetch' | |
var url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=PLIC7a_CaE8nWRJzDr2JuVrS21jo4H1n32&key=AIzaSyDo49g75WoT2d1y1WJeJjVa7OxivoGw1aQ"; | |
var videoIdArray = []; | |
var videoUrlArray = []; | |
fetch(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myArr = [{ | |
num: 5, | |
str:'apple' | |
},{ | |
num: 7, | |
str:'cabbage' | |
},{ | |
num: 1, | |
str:'ban' | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildArray(){ | |
//build array containing images IDs | |
var myArray = []; | |
myArray[0] = []; | |
myArray[0][0] = []; | |
var i = 0; | |
$('.img-responsive').each(function(){ | |
myArray[0].push($(this).attr('id')); | |
myArray[0][0].push($(this).attr('src')); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = [[12, 'AAA'], [58, 'BBB'], [28, 'CCC'],[18, 'DDD']]; | |
a.sort(sortFunction); | |
//display result | |
alert(a); | |
//sorts array by first array column, change values of 0 to 1 to sort by second column | |
function sortFunction(a, b) { | |
if (a[0] === b[0]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function merge(obj1, obj2){ | |
var obj3 = []; | |
for (var i= 0, len = obj1.length; i < len; i++) { | |
obj3.push(obj1[i]); | |
obj3.push(obj2[i]); | |
} | |
return obj3; | |
} | |
//calls merge function, removes commas using join, displays output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//draw on home image | |
var canvas = document.querySelector('#paint'); | |
var ctx = canvas.getContext('2d'); | |
var sketch = document.querySelector('.sketch'); | |
var sketch_style = getComputedStyle(sketch); | |
canvas.width = parseInt(sketch_style.getPropertyValue('width')); | |
canvas.height = parseInt(sketch_style.getPropertyValue('height')); | |
var mouse = {x: 0, y: 0}; | |
var last_mouse = {x: 0, y: 0}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//draw on home image | |
var canvas = document.querySelector('#paint'); | |
var ctx = canvas.getContext('2d'); | |
var sketch = document.querySelector('.sketch'); | |
var sketch_style = getComputedStyle(sketch); | |
canvas.width = parseInt(sketch_style.getPropertyValue('width')); | |
canvas.height = parseInt(sketch_style.getPropertyValue('height')); | |
var mouse = {x: 0, y: 0}; | |
var last_mouse = {x: 0, y: 0}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = "<h2>Full Stack Development</h2>", | |
i = 0, | |
isTag, | |
text; | |
(function type() { | |
text = str.slice(0, ++i); | |
if (text === str) return; | |
document.getElementById('typewriter').innerHTML = text; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="ajax-contact" class="form-horizonta" method="post" action="mailer.php"> | |
<div class="field form-group"> | |
<label for="name" class="control-label">Name:</label> | |
<input class="form-control" type="text" id="name" name="name"> | |
</div> | |
<div class="field form-group"> | |
<label for="email" class="control-label">Email:</label> | |
<input class="form-control" type="email" id="email" name="email"> | |
</div> | |
<div class="field form-group"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
// Get the form. | |
var form = $('#ajax-contact'); | |
// Get the messages div. | |
var formMessages = $('#form-messages'); | |
// Set up an event listener for the contact form. | |
$(form).submit(function(e) { | |
// Stop the browser from submitting the form. |
NewerOlder