Skip to content

Instantly share code, notes, and snippets.

View xgqfrms's full-sized avatar
💭
🎉 👻 💻 🕵️‍♂️

xgqfrms xgqfrms

💭
🎉 👻 💻 🕵️‍♂️
View GitHub Profile
@xgqfrms
xgqfrms / it-ebooks.md
Created January 29, 2023 15:09 — forked from baiwfg2/it-ebooks.md
Download ebooks as you want
@xgqfrms
xgqfrms / linux-shell-comments-EOF.md
Last active April 9, 2024 06:39 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script

appify

#!/bin/bash

if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
@xgqfrms
xgqfrms / element.js
Created July 6, 2022 08:47 — forked from dfkaye/element.js
Create a DOM element from template string using DOMParser
// 1 April 2020
// variant on jsx in vanilla.js
// see https://gist.github.com/dfkaye/f3229e5ace79b6873022987f160c7b61
// takes a template string and mimeType
// returns dom element from the template string
// TODO (maybe) - add UI map capability - i.e. UI = { name: <node with var=name> }
function element(template, mimeType) {
return (new DOMParser)
@xgqfrms
xgqfrms / rollup.config.js All In One.md
Last active July 6, 2022 08:42 — forked from evdama/rollup.config.js
rollup.config.js All In One
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess

// import { eslint } from 'rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
@xgqfrms
xgqfrms / watermark.md
Last active January 26, 2022 09:35 — forked from anonymous/example.js
watermark (SVG + Base64)

watermark

var svgText = '<...>'; // SVG source XML

// New browsers: Blob URL
var svgBlob = new Blob([svgText], {type : 'image/svg+xml'});
myImage.src = URL.createObjectURL(svgBlob);
@xgqfrms
xgqfrms / JsBlobSaveJson
Created April 8, 2021 16:26 — forked from yiwenl/JsBlobSaveJson
Javascript using Blob to save json file
var saveJson = function(obj) {
var str = JSON.stringify(obj);
var data = encode( str );
var blob = new Blob( [ data ], {
type: 'application/octet-stream'
});
var url = URL.createObjectURL( blob );
var link = document.createElement( 'a' );
@xgqfrms
xgqfrms / protips.js
Created November 16, 2020 05:18 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
/**
* express static server for react build/dist test!
*/
// simple express server for HTML pages!
// ES6 style
const express = require('express');
const fs = require('fs');
const hostname = '127.0.0.1';