Skip to content

Instantly share code, notes, and snippets.

View khatthaphone's full-sized avatar

Khatthaphone Sengvilai khatthaphone

View GitHub Profile
@1eedaegon
1eedaegon / readImageFromExcel.js
Last active May 3, 2024 02:51
Read image from excel file using ExcelJS
const ExcelJS = require('exceljs');
const workbook = new ExcelJS.Workbook();
const data = await workbook.xlsx.readFile('./test.xlsx');
const worksheet = workbook.worksheets[0];
for (const image of worksheet.getImages()) {
console.log('processing image row', image.range.tl.nativeRow, 'col', image.range.tl.nativeCol, 'imageId', image.imageId);
// fetch the media item with the data (it seems the imageId matches up with m.index?)
const img = workbook.model.media.find(m => m.index === image.imageId);
fs.writeFileSync(`${image.range.tl.nativeRow}.${image.range.tl.nativeCol}.${img.name}.${img.extension}`, img.buffer);
@rvanzon
rvanzon / nuxt.config.js
Last active September 1, 2022 13:25
A way to use vue-chartjs as a plugin of Nuxt.js
// just an example. A cleaner way is to wrap the showLine-stuff in a dedicated component
<template>
<div>
<my-line v-if="showLine" :data="lineData" :options="options">
</div>
</template>
<script>
export default {
data () {
@robinsk
robinsk / BrowserPrint-1.0.4.js
Last active August 27, 2023 00:45
Zebra Browser Print SDK
var BrowserPrint = function() {
function e(e) {
return s + e
}
function n(e, n) {
var i = new XMLHttpRequest;
return "withCredentials" in i ? i.open(e, n, !0) : "undefined" != typeof XDomainRequest ? (i = new XDomainRequest, i.open(e, n)) : i = null, i
}
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE