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
| tinyurl.com/domfitc | |
| //// Insert elements | |
| el.insertAdjacentHTML(<location>, <HTML string>); | |
| // locations | |
| <!-- beforebegin --> | |
| <div> | |
| <!-- afterbegin --> | |
| <p>some text</p> |
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 array = [1,2,3,4,5,6]; console.log(array.slice(-1)); // [6] console.log(array.slice(-2)); // [5,6] console.log(array.slice(-3)); // [4,5,6] | |
| var array = [1,2,3,4,5,6]; console.log(array.length); // 6 | |
| array.length = 3; console.log(array.length); // 3 console.log(array); // [1,2,3] | |
| Array.push.apply(arr1, arr2) which instead creates a new array – it will merge the second array in the first one reducing the memory usage. | |
| var array1 = [1,2,3]; var array2 = [4,5,6]; console.log(array1.push.apply(array1, array2)); // [1,2,3,4,5,6]; | |
| NodeList to Array | |
| var ps=document.querySelectorAll("p"); |
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 solidus = { long: '̸', short: '̷' } | |
| var stroke = { long: '̶', short: '̵' } | |
| function strikeThrough(str, bar) { | |
| return str.replace(/(\w)/g, '$1' + bar) | |
| } | |
| var a = '̴' | |
| var underline = '͟' | |
| █ |
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
| function inKB(s) { | |
| s = (new TextEncoder('utf-8').encode(s)).length / 1024 | |
| return s.toFixed(2) | |
| } |
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
| /* CSS Mini Reset */ | |
| html, body, div, form, fieldset, legend, label | |
| { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| table | |
| { |
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
| /* -------------------------------------------------------------- | |
| Hartija Css Print Framework | |
| * Version: 0.8 (2008-03-10) | |
| -------------------------------------------------------------- */ | |
| body { | |
| width:100% !important; | |
| margin:0 !important; |
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
| /* reset */ | |
| * {margin: 0;padding: 0;box-sizing: border-box;} | |
| /* css grid */ | |
| .dp50 {width:50%; float:left; display: inline; *margin-right:-1px; } | |
| /* two line css grid http://www.vcarrer.com/2010/10/two-lines-css-framework.html */ | |
| .row { display:table; width:960px; margin:0 auto } | |
| .cell { display:table-cell; vertical-align:top; padding-left:10px } |
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
| /*------------------------------------- | |
| BEM (Block Element Modifier) | |
| -------------------------------------*/ | |
| /* | |
| <a href="http://css-tricks.com" class="btn btn--green btn--big"> | |
| <span class="btn__price">$9</span> | |
| <span class="btn__text">Big button</span> | |
| </a> | |
| */ |
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
| function isNeg0 (n) { | |
| return n===0 && (1/n)===-Infinity | |
| } | |
| if (!Number.isNaN) Number.isNaN = num => num !== num | |
| // best way to do it in es6+ | |
| Object.is(0, -0)// false | |
| Object.is(NaN, NaN)// true | |
| var a = [1,5,3,4,8] |
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
| $folder1 = "C:\Users\himalay\projects\test\test1" | |
| $folder2 = "C:\Users\himalay\projects\test\test2" | |
| $firstFolder = Get-ChildItem -Recurse $folder1 | Where-Object { -not $_.PsIsContainer } | |
| $firstFolder | ForEach-Object { | |
| $secondFile = $_.FullName.Replace($folder1, $folder2) | |
| If ( Test-Path $secondFile ) { | |
| If ( (Get-FileHash $_.FullName).hash -eq (Get-FileHash $secondFile).hash ) { |