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
const a = 'a'; | |
const b = 'b'; | |
const oA = { a }; // ES6 shortcut, same as const oA = { a: a }; | |
const oB = { b }; | |
//composing objects with ES6 spread operator | |
const c = {...oA, ...oB}; // { a: 'a', b: 'b' } | |
//composing objects with Object.assign() | |
const d = Object.assign({}, oA, oB); // { a: 'a', b: 'b' } |
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
// sum the squares from 1 to N | |
const square = x => x * x; | |
const add = (a, b) => a + b; | |
const sumSquares = n => Array.from(Array(n+1).keys()) | |
.map(square) | |
.reduce(add); | |
console.log(sumSquares(5)); |
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
const add = x => y => x+y; | |
console.log(add(2)(5)); //7 |
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> | |
<head> | |
<title>My Page</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></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
p:first-letter{ | |
display:block; | |
margin:5px 0 0 5px; | |
float:left; | |
color:#000; | |
font-size:60px; | |
font-family:Georgia; | |
} |
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
html { | |
background: url(../img/your-background-image.jpg) no-repeat center center fixed; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; | |
} |
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> | |
<head> | |
<style> | |
body{ | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: 13px; | |
} | |
.info, .success, .warning, .error, .validation { | |
border: 1px solid; |
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
$(document).ready(function(){ | |
$("#checkboxall").change(function(){ | |
var checked_status = this.checked; | |
$("input[name=checkall]").attr("checked", checked_status); | |
}); | |
}); |
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 tog = false; // or true if they are checked on load | |
$('a').click(function() { | |
$("input[type=checkbox]").attr("checked",!tog); | |
tog = !tog; | |
}); |
NewerOlder