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
// count time | |
console.time("Loop timer") | |
for(i = 0; i < 10000; i++){ | |
// Some code here | |
} | |
console.timeEnd("Loop timer") | |
//group | |
console.group("My message group"); | |
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 notes = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'Ab', 'Bb', 'Cb', 'Db', 'Eb', 'Fb', 'Gb']; | |
const chords = ['', '7', 'm', 'm7', 'maj7', 'dim', 'm7-5']; | |
chords.map(ch => notes.map(n => n+ch)).flat().sort(() => Math.random() - 0.5).join(' ') |
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
export const dateTimeToDate = (dotNetDate: string): Date => { | |
var re = /(\/Date\()(\d*)(\)\/)/; | |
var millisecondsString = dotNetDate?.replace(re, "$2") ?? ''; | |
return millisecondsString ? new Date(parseInt(millisecondsString)) : new Date(); | |
} |
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
// if (process.env.NODE_ENV === 'development') { | |
// const whyDidYouRender = require('@welldone-software/why-did-you-render'); | |
// whyDidYouRender(React, { | |
// trackAllPureComponents: true, | |
// }); | |
// } |
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
using System.IO; | |
using System.Web.Mvc; | |
namespace Foundation.Helpers | |
{ | |
public static class ConvertHelper | |
{ | |
public static string RenderViewToString(ControllerContext context, string viewName, object model) | |
{ | |
if (string.IsNullOrEmpty(viewName)) |
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
export const fillTemplate = (templateString, templateVars) => { | |
return templateString ? templateString.replace(/{([^{}]*)}/g, | |
function(a, b) { | |
var r = templateVars[b]; | |
return typeof r === 'string' || typeof r === 'number' ? r : a; | |
} | |
) : ''; | |
}; | |
//// |
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
(props) => { | |
const [elHeight, setElHeight] = useState(0); | |
const elRef = useRef(null); | |
const onButtonClick = (e) => { | |
elHeight ? setElHeight(0) : setElHeight(elRef.current.scrollHeight); | |
}; | |
const elStyle = { | |
maxHeight: elHeight, | |
}; |
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
overflow-y: scroll; | |
-ms-overflow-style: none; | |
&::-webkit-scrollbar { | |
display: none; | |
} |
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
using System.Web.Mvc; | |
using EPiServer; | |
using EPiServer.Core; | |
using EPiServer.Framework.DataAnnotations; | |
using EPiServer.Web.Mvc; | |
using EPiServer.Web.Mvc.Html; | |
namespace Foundation.Features.Blocks | |
{ | |
[TemplateDescriptor(Default = true)] |
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 vw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); | |
const vh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); |
NewerOlder