Skip to content

Instantly share code, notes, and snippets.

View Saabbir's full-sized avatar

Saabbir Hossain Saabbir

View GitHub Profile
@Saabbir
Saabbir / optimizely-x-js-api.js
Created June 4, 2024 10:50 — forked from jamesspittal/optimizely-x-js-api.js
JS API calls for Optimizely X
// Top-level functions
window.optimizely.get('state');
window.optimizely.get('data');
window.optimizely.get('visitor'); // For custom attributes and such
window.optimizely.get('behavior'); // For behavior queries
// Common examples
window.optimizely.get('state').getActiveExperimentIds(); // Returns an array of active experiment IDs on a page.
window.optimizely.get('data').revision; // Returns the revision that the snippet on the page is on. Useful in determining whether you are looking at the most updated changes made within a campaign.
window.optimizely.get('state').getVariationMap(); // Returns an object of experiment IDs and the corresponding variation ID a user has been bucketed into. Equivalent of classic Optimizely Testing's optimizelyBuckets cookie (which is no longer available within Optimizely X Web).
@Saabbir
Saabbir / hyper.js
Created November 15, 2023 20:22 — forked from coco-napky/hyper.js
Hyper config for git bash in Windows
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',

How to extract vector graphics (SVG images) from a PDF file

What we need to do:

  1. Enable WSL on Windows 10.
  2. Install Ubuntu (latest version) on WSL from the Windows Store.
  3. Install poppler-utils Command-line tool on WSL.
  4. Convert PDF file to an SVG file using pdftocairo tool, contained into poppler-utils.
  5. Use Inkspace to ungroup, copy, paste the desired vector graphic to a new SVG file.
  6. Use Illustrator to export that graphic as an SVG image.

How to fix "ReferenceError: primordials is not defined" error in NodeJS

Here's what you need to do:

Step 1

In the same directory where you have package.json create an npm-shrinkwrap.json file with the following contents:

{

Keybase proof

I hereby claim:

  • I am saabbir on github.
  • I am saabbir (https://keybase.io/saabbir) on keybase.
  • I have a public key ASCjaucQKEWUK2Adxv_Qzoadsv9jFkQHQizulYj8twQD4Qo

To claim this, I am signing this object:

@Saabbir
Saabbir / get-siblings.js
Created August 4, 2019 05:22
A short function to get all siblings of an element.
/**
* Get siblings of an element
* @param {Element} elem
* @return {Array}
*/
function getSiblings(elem) {
return [...elem.parentNode.children].filter(item => item !== elem);
}