Skip to content

Instantly share code, notes, and snippets.

View cnt000's full-sized avatar
๐Ÿš€

Edoardo Gargano cnt000

๐Ÿš€
View GitHub Profile
@cnt000
cnt000 / jest mocking
Last active February 24, 2022 14:02
Sme tips about jest mocking
### mocking window.location.href
global.window.location = {
href: 'https://test-domain.com.br'
}
Object.defineProperty(window, 'location', {
value: {
...window.location,
href: 'http://www.testsite.com'
*** SDS Setup File Version 3
*** Output Plate Size 384
*** Output Plate ID PGP670_Type61_IMPORT-RT_PLATE1.txt
*** Number of Detectors 10
Detector Reporter Quencher Description Comments AIF Assay ID
AA FAM
AA. VIC
CC FAM
CC. VIC
GG FAM
const getRealWidth = (src, cb) => {
const img = new Image();
img.src = src;
img.onload = cb;
};
const printSrcSetDebug = (elm, showFn) => {
getRealWidth(elm.currentSrc, function () {
showFn(`
src: ${elm.src},
CSS Pseudo Classes
Pseudo-classes select elements that already exist.
Based on current state of UI
:hover - an element is hovered
:enabled - an element is eanabled
:disabled - an element is disabled
:checked - an element is checked
<script>
(function() {var yorbs = document.createElement("script");yorbs.type = "text/javascript";yorbs.async = true;yorbs.src = ("https:" == document.location.protocol ? "https://" : "http://") + "secure.social.yoox.it/storage/rd/yorb/yorb.min.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(yorbs, s);})();
</script>
@cnt000
cnt000 / revert-a-commit.md
Created February 23, 2018 14:11 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

!(function(a,d,g,b){var c,h,e,f;a.Virtusize=b;a[b]=a[b]||[];a[b].env=null!=a.vsEnv?a.vsEnv:"production";a[b].url=null!=a.vsUrl?a.vsUrl:a.location.host;a.vsEnv=void 0;a.vsUrl=void 0;a[b].methods="setApiKey setRegion setLanguage setWidgetOverlayColor addWidget ready setMobile on setAvailableSizes setSizeAliases addOrder addFindByFit setUserId".split(" ");a[b].factory=function(c){return function(){var d;d=Array.prototype.slice.call(arguments);d.unshift(c);a[b].push(d);return a[b]}};f=a[b].methods;c=0;for(h=f.length;c<h;c++)e=f[c],a[b][e]=a[b].factory(e);a[b].snippetVersion="4.0.0";c=d.createElement(g);d=d.getElementsByTagName(g)[0];c.async=1;c.src={production:"https://cdn.api.virtusize.com/integration/v4.js",staging:"https://cdn.staging.virtusize.com/integration/v4.js",local:"//"+a[b].url+"/integration/v4.source.js"}[a[b].env];c.id="vs-integration";d.parentNode.insertBefore(c,d)})(window,document,"script","vs");
function VirtusizeWidgetCtrl() {
var API_KEY = 'c5bae1b62648a0f535d9a3585ba70ab20c4b91d0';
var