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
# Install ImageMagick if not already present | |
if not command -sq magick | |
echo "Installing ImageMagick..." | |
brew install imagemagick | |
end | |
# Set the path to the folder containing SVG files | |
set svg_folder ~/Downloads/path |
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
function downloadAllImages(container) { | |
const imageElements = container.querySelectorAll('img'); | |
if (!imageElements.length) { | |
console.error('No images found in the container.'); | |
return; | |
} | |
for (const imageElement of imageElements) { | |
const imageUrl = imageElement.src; |
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
function getCloudflareJSON(data): Promise<{ | |
fl: string | |
h: string | |
ip: string | |
ts: number | |
visit_scheme: string | |
uag: string | |
colo: string | |
http: string | |
loc: string |
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
select { | |
display: block; | |
font-size: 12px; | |
font-family: sans-serif; | |
font-weight: 600; | |
color: #4d6178; | |
line-height: 14px; | |
padding: 8px 12px 8px 8px; | |
width: 100%; | |
max-width: 100%; |
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
import React, { useState } from 'react'; | |
import ClassNames from 'classnames'; | |
import { Table as FixedTable, Column } from 'fixed-data-table-2'; | |
import '!!style-loader!css-loader!fixed-data-table-2/dist/fixed-data-table-base.css'; | |
import { get } from 'lodash'; | |
import { ellipseString } from '../../helpers/BaseUtils'; | |
import { HTML_ICON, Icon, ICON_SIZES } from '../Icons/Icons'; | |
import { Text, TEXT_SIZE } from '../Text/Text'; | |
import { Tooltip } from '../Tooltip/Tooltip'; |
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
function Store(initialData, options = {}) { | |
const handlers = []; | |
let nextHandlerId = 0; | |
return { | |
get data() { | |
return initialData; | |
}, | |
set data(t) { | |
console.log("Set was called"); |
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
Array.prototype.multiply = function(){ | |
const le = this.length; | |
for(let i=0; i < le; i++){ | |
this[i+le] = this[i]*this[i]; | |
console.log(this) | |
} | |
}; | |
const a = [1, 2, 3, 4, 5]; | |
a.multiply(); |
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
import Promise from 'Bluebird'; | |
function updateUser() { | |
return new Promise((resolve, reject, onCancel) => { | |
let cancelled = false; | |
// you need to config Bluebird to have cancellation | |
// http://bluebirdjs.com/docs/api/promise.config.html | |
onCancel(() => { | |
cancelled = 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
export const CancellablePromise = (promise) => { | |
let isCancelled = false; | |
const wrappedPromise = new Promise((resolve, reject) => { | |
promise.then( | |
(...args) => (isCancelled ? reject('cancelled') : resolve(...args)), | |
error => (isCancelled ? reject('cancelled') : reject(error)), | |
); | |
}); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder