Skip to content

Instantly share code, notes, and snippets.

View scabbiaza's full-sized avatar

Tatiana Kleshnina scabbiaza

View GitHub Profile
// check that event.target is the one that we need
var isNavbarToogle = event.target.path.filter(function(item) {
return (item.classList.contains("navbar-toggle") || item.classList.contains("navbar-header"));
}).length == 2;
// to know when gulp task is end
Gulp.task("name", function () {
console.log('started >>>');
return .....
.pipe(Gulp.dest("build"))
// http://jquense.github.io/react-widgets/docs/#/datetime-picker
//
// <form>
// [date] [time]
// </form>
//
// Both fields return datetime format:
// To compine them in one
let dateField = "Fri Jun 12 2015 15:08:31 GMT+0200";
@scabbiaza
scabbiaza / gist:b75f4725c7c1bf7b5513
Created June 11, 2015 14:36
JS: missed module error cases
*Compilation JS with gulp-browserify*
Case # 0. Any error in NOT included files
Result: no errors by compilation and running
Case # 1. Missed lib on the disk
app.js
@scabbiaza
scabbiaza / List of vectors for checking on XSS
Last active December 29, 2023 07:44
ReactJS - prevent XSS vulnerability
// Theory
// http://htmlpurifier.org/live/smoketests/xssAttacks.php
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// A full collection of HTML5 related XSS attack vectors:
// https://github.com/cure53/H5SC https://raw.githubusercontent.com/cure53/H5SC/master/vectors.txt
// Short list
<script>alert("XSS: script tag")</script>
<script src="http://hackers-site.powertofly.com"></script>
@scabbiaza
scabbiaza / 1.md
Last active February 8, 2018 09:40
js: concepts

Data Types, mutable, immutable

What data types in JS do you know? What data types are mutable? How to solve mutability problem in the code?

var person1 = {name: 'Ana'};
var person2 = person1;
person1.name = 'Julia';
console.log(person1.name);
console.log(person2.name);
@scabbiaza
scabbiaza / git
Last active August 29, 2015 14:26
# Set editor
https://help.github.com/articles/associating-text-editors-with-git/
$ git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"

Fonts

Keep fonts optimized

  1. Set should be as minimum as possible

  2. Fallback on smaller fontset / standart fontset on mobile devices

  3. woff2 fonts types for progressive browser (Chrome, Opera, Android)
    Converter: https://everythingfonts.com/woff-to-woff2

@scabbiaza
scabbiaza / Semantic-UI-flexibility.md
Last active August 29, 2015 14:27
Semantic-UI flexibility

Ability to compile styles from own build system 👍

How to: https://github.com/Semantic-Org/Semantic-UI-LESS

Ability to store site styles separately from semantic and in own place 👍

Put files wherever you need, but update path to this folder in the theme.config

@scabbiaza
scabbiaza / gist:ecab1f18f5c168d3e9b5
Created September 1, 2015 09:20
Bind/unbind with namespaces
// handler for click event
var h1 = $("h6").bind("click", function () {
console.log('click handler');
});
// handler for click event with namespace
var h2 = $("h6").bind("click.namespace", function () {
console.log('click handler with namespace');
});
// click event result:
@scabbiaza
scabbiaza / notes.md
Last active November 24, 2015 13:46
Notes from the Book "High Performance Javascript" by N. Zakas

The book i'm reading is from 2010, so i want to keep only things that are important now, in 2015, and add some comments about the current situation with having ES2015 and modern libs in place.

Loading and Execution

Every time a <script> tag is encountered, the page must stop and wait for the code to download (if external) and execute before continuing to process the rest of the page. JavaScript’s tendency to block browser processes, both HTTP requests and UI updates,