This file contains hidden or 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 | |
<blockquote> | |
<p id="quotation"></p> | |
<footer> | |
<p id="source"></p> | |
</footer> | |
</blockquote> | |
<button>Generate Quote</button> | |
``` |
This file contains hidden or 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 consoleStyles = { | |
'h1': 'font: 2.5em/1 Arial; color: crimson;', | |
'h2': 'font: 2em/1 Arial; color: orangered;', | |
'h3': 'font: 1.5em/1 Arial; color: olivedrab;', | |
'bold': 'font: bold 1.3em/1 Arial; color: midnightblue;', | |
'warn': 'padding: 0 .5rem; background: crimson; font: 1.6em/1 Arial; color: white;' | |
}; | |
function log ( msg, style ) { | |
if ( !style || !consoleStyles[ style ] ) { | |
style = 'bold'; |
This file contains hidden or 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
// http://www.barbarianmeetscoding.com/blog/2016/04/27/a-look-at-es6-maps/ | |
const wizardsArchive = new Map(); | |
wizardsArchive.set('jaime', { | |
name: 'jaime', | |
title: 'The Bold', | |
race: 'ewok', | |
traits: ['joyful', 'hairless'] |
This file contains hidden or 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
$('div'); // all div | |
$('#id_name'); // element id="id_name" | |
$('.class_name'); // element class="class_name" | |
$('div#id_name'); // all div's with did_name" | |
$('div.class_name'); // all div's with class="class_name | |
$('div h1'); // all h1 in div |
This file contains hidden or 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
Show hidden characters
{ | |
"maxerr": 25, | |
"latedef": "nofunc", | |
"browser": true, | |
"node": true, | |
"globals": ["$", "Prism"], | |
"indent": 2, | |
"camelcase": true, | |
"newcap": true, | |
"undef": true, |
This file contains hidden or 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
https://packagecontrol.io/packages/Front%20End%20Snippets | |
http://www.dejurka.ru/css/javascript_snippets/ | |
http://css-tricks.com/snippets/ | |
gist: fronend dev | |
https://gist.github.com/agragregra |
This file contains hidden or 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> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.css"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js" charset="utf-8"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.js"></script> | |
</head> | |
<body> |
This file contains hidden or 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 out = 0; | |
function squareSum(numbers){ | |
// Стоит отметить, что условие перехода к следующей итерации | |
// цикла выполняется для КАЖДОГО его элемента. Это значит, | |
// что имея массив из 10 тысяч элементов вы 10 тысяч раз выполните | |
// numbers.length. Согласитесь, это не очень то эффективно (особенно | |
// если учесть, что длина массива не меняется). |
This file contains hidden or 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
// 1 | |
var arr = []; | |
var filesArr = ['file.jpg', 'secfile.jpg', 'elsefile.jpg']; | |
filesArr.forEach(function(element) { | |
var obj = {}; | |
obj['image_id'] = element; | |
arr.push(obj); | |
}); |