Skip to content

Instantly share code, notes, and snippets.

@va1729
va1729 / webp-converter.ps1
Last active June 4, 2024 15:58
Run cwebp over all png files in a directory in Poweshell
Get-ChildItem -File -Filter "*.png" | ForEach {cwebp $_.fullname -o "$($_.basename).webp" -mt}
# Get all png files. Pipe the output to a ForEach command that runs cwebp against the given file.
@va1729
va1729 / .nvmrc
Last active February 22, 2021 07:43
How to specify platform architecture in nvmrc?
# In .nvmrc
v12.18.4/x86
<w:style w:type="paragraph" w:customStyle="1" w:styleId="Parastyle">
<w:name w:val="Para style" />
<w:basedOn w:val="ListParagraph" />
<w:qFormat />
<w:rsid w:val="00E046F2" />
<w:pPr>
<w:numPr>
<w:numId w:val="2" />
</w:numPr>
<w:jc w:val="center" />
name: Messing around with bindings
description: ''
host: WORD
api_set: {}
script:
content: |
$("#run").click(run);
$("#run2").click(run2);
$("#run3").click(run3);
$("#run4").click(run4);
@va1729
va1729 / goToByIdAsync2.WORD.yaml
Created June 24, 2019 06:48
This snippet call goToByIdAsync function. The callback function is never called.
name: goToByIdAsync2
description: >-
This snippet call goToByIdAsync function. The callback function is never
called.
host: WORD
api_set: {}
script:
content: |
$("#run").click(run);
$("#run2").click(run2);
@va1729
va1729 / goToByIdAsync.WORD.yaml
Created June 24, 2019 06:04
This snippet call goToByIdAsync function. The callback function is never called.
name: goToByIdAsync
description: >-
This snippet call goToByIdAsync function. The callback function is never
called.
host: WORD
api_set: {}
script:
content: |
$("#run").click(run);
@va1729
va1729 / read-document.js
Created September 30, 2018 17:53
Use promises (async/await) to read document using Office.js
const getDocument = async (file) => {
let currentSlice = 0;
let data = [];
while (currentSlice !== file.sliceCount) {
const slicePromise = new Promise(resolve => file.getSliceAsync(currentSlice, resolve));
const result = await slicePromise;
if (result.status !== "succeeded") {
file.closeAsync();
return { status: "failed" };
}
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
</Relationships>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
<pkg:xmlData>
<resources>
<string name="app_name" translatable="false">Trringo Biz</string>
<string name="welcome_message">Namaste</string>
<!-- Logo related strings -->
<string name="caption">AB TRACTOR CALL KARO</string>
<!-- Business context strings -->
<string name="customer">Customer</string>
@va1729
va1729 / algorithms.py
Last active September 16, 2016 10:43
Design patterns social HU - Assignment - Travel Portal
class CryptographicAlgorithm(object):
def encrypt(document):
pass
def decrypt(document):
pass
class SymmetricKeyAlgorithm(CryptographicAlgorithm):
def encrypt(document):
pass