Skip to content

Instantly share code, notes, and snippets.

```html
<blockquote>
<p id="quotation"></p>
<footer>
<p id="source"></p>
</footer>
</blockquote>
<button>Generate Quote</button>
```
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';
// 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']
$('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
@tsvetkovpro
tsvetkovpro / .jshintrc
Last active July 23, 2016 15:21
settings:
{
"maxerr": 25,
"latedef": "nofunc",
"browser": true,
"node": true,
"globals": ["$", "Prism"],
"indent": 2,
"camelcase": true,
"newcap": true,
"undef": true,
@tsvetkovpro
tsvetkovpro / snippets
Last active April 12, 2016 03:08
links:
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
@tsvetkovpro
tsvetkovpro / Animals
Last active June 27, 2016 02:19
html:
<!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>
// Здесь вы определяете ГЛОБАЛЬНУЮ переменную, засоряя при этом глобальное пространство имен.
// В будущем это может привести к очень неочевидным проблемам при отладке.
var out = 0;
function squareSum(numbers){
// Стоит отметить, что условие перехода к следующей итерации
// цикла выполняется для КАЖДОГО его элемента. Это значит,
// что имея массив из 10 тысяч элементов вы 10 тысяч раз выполните
// numbers.length. Согласитесь, это не очень то эффективно (особенно
// если учесть, что длина массива не меняется).
// 1
var arr = [];
var filesArr = ['file.jpg', 'secfile.jpg', 'elsefile.jpg'];
filesArr.forEach(function(element) {
var obj = {};
obj['image_id'] = element;
arr.push(obj);
});