A Pen by Benjamin Berglund on CodePen.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<script src="script.js" defer></script> | |
</head> | |
<body> |
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
npm run test:unit | |
TEST_RESULT=$? | |
if [ $TEST_RESULT -eq 0 ] | |
then echo "Tests passed. Committing..." | |
else echo "Testing your changes has failed! Commit will be aborted." && exit 1 | |
fi |
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
npm test | |
TEST_RESULT=$? | |
if [ $TEST_RESULT -eq 0 ] | |
then echo "Tests passed. Committing..." | |
else echo "Testing your changes has failed! Commit will be aborted." && exit 1 | |
fi |
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
// 29 Sep 2017 | |
// 4 Oct 2017 - add name object example. | |
// 14 Nov 2017 - pass `a.name, b.name` to `byName()`; rename `test` as `diff`. | |
// 1 Jan 2018 - made some functions more readable. | |
// Inspired by post at https://alistapart.com/article/what-i-talk-about-when-i-talk-about-sorting | |
// which covers an example of sorting by age, but does not ensure items of same age are secondarily | |
// sorted by name in alphabetical order. | |
// This snippet shows how to do that whether names are strings or objects with first and last properties. |
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<form method="post"> | |
First name:<br> | |
<input type="text" name="firstname" value="Mickey"> | |
<br> | |
Last name:<br> | |
<input type="text" name="lastname" value="Mouse"> |
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
// see it at https://jsbin.com/mejoke/edit?html,js,console,output | |
var data = [ | |
{ | |
filename:'england', | |
path: 'england/', | |
children:[ | |
{ | |
filename:'1920', | |
path: 'england/1920/' , |
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
// Vi sätter de variabler vi vill ha tillgång till inifrån alla funktioner | |
var body = $('body'); | |
var displayBox = $('#displayBox'); | |
var bokstavInput = $('#bokstav'); | |
// (tills vidare hårdkodar vi vårt hemliga ord) | |
var hemligtOrd = 'BRO'; | |
var galgKroppDelar = []; | |
var doltOrd = []; | |
var anvandaBokstaver = []; | |
var maxAntalGissningar; |
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
// Vi sätter de variabler vi vill ha tillgång till inifrån alla funktioner | |
// (tills vidare hårdkodar vi vårt hemliga ord) | |
var hemligtOrd = 'BRO'; | |
var galgKroppDelar = []; | |
var doltOrd = []; | |
var anvandaBokstaver = []; | |
var maxAntalGissningar; | |
function display(str){ |
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
// Övningsuppgifter 1 vecka 6: | |
// Vi har vår data: | |
// Men lägg till ett par Stockholmare för oss att söka på också: | |
var list = [ | |
{firstName: 'Benjamin', | |
lastName: 'Berglund', | |
age: 46, | |
city: 'Malmö'}, |
NewerOlder