Skip to content

Instantly share code, notes, and snippets.

Avatar
🌱
🐸

Florian Wendelborn FlorianWendelborn

🌱
🐸
View GitHub Profile
@GavinRay97
GavinRay97 / guide.md
Last active Sep 8, 2021
Configuring Nuxt for Composition API and TSX Support
View guide.md

Main

EDIT: DO NOT USE THIS. THIS WAS FROM WHEN ALL OF THIS WAS NEW/EXPERIMENTAL AND NOT OFFICIALLY SUPPORTED. PLEASE SEE THE LINK BELOW FOR THE PROPER, EASIER INTEGRATION NOWADAYS =)

Use create-nuxt-app and enable the Typescript related options to scaffold a new boilerplate TS Nuxt repo:

yarn create nuxt-app <my-project>
View biggan_api.py
import math
from moviepy.editor import concatenate, ImageClip
import os
import platform
import subprocess
import random
import torch
# pip install pytorch-pretrained-biggan
from pytorch_pretrained_biggan import (BigGAN, truncated_noise_sample, convert_to_images)
import numpy as np
@acutmore
acutmore / README.md
Last active Sep 10, 2021
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)
View README.md

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
    ["peek", _],           // 3
@alexkrauss
alexkrauss / gitlab-timeline.html
Created Aug 16, 2018
Timeline charts for Gitlab build jobs
View gitlab-timeline.html
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// This is a quick hack to be able to see Gantt-like Timelines of gitlab build pipelines.
// It makes it easier to diagnose the running time of the pipelines and understand resource usage.
// Ideally, gitlab would directly provide such a view in its frontend.
google.charts.load('current', {'packages':['gantt']});
@towfiqpiash
towfiqpiash / html2plainText.js
Last active Dec 2, 2020
Javascript function to convert HTML to plain text
View html2plainText.js
// converts HTML to text using Javascript
function html2text(html) {
var tag = document.createElement('div');
tag.innerHTML = html;
return tag.innerText;
}
// Convert Any copied text to plain text in TinyMCE (strip all tags)
paste_preprocess: function(plugin, args) {
@itsMapleLeaf
itsMapleLeaf / auto-resize-tree-view.less
Created Mar 24, 2017
Styles for an automatically resizing tree-view
View auto-resize-tree-view.less
.tree-view-resizer {
width: max-content;
}
// hide the resize handle so we don't accidentally break things
.tree-view-resize-handle {
display: none;
}
// add some padding for breathing room (optional)
@kanaka
kanaka / addTwo.wast
Last active Jun 17, 2021
Run wast (WebAssembly) in node
View addTwo.wast
(module
(func $addTwo (param i32 i32) (result i32)
(i32.add
(get_local 0)
(get_local 1)))
(export "addTwo" (func $addTwo)))
@hnry
hnry / catch-all-middleware.js
Created Feb 1, 2017
catch all unhandled errors or bad responses
View catch-all-middleware.js
const spirit = require("spirit").node
const catchall = (handler) => (request) => handler(request).then((resp) => {
// something beforehand gave a bad response
// set our own custom message
if (!spirit.is_response(resp)) {
return { status: 500, headers: {}, body: "generic error message because of bad response" }
}
return resp
// something beforehand threw an error
@Restuta
Restuta / framework-sizes.md
Last active Sep 4, 2021
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)
View framework-sizes.md

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan  4 22:03 angular2.min.js
@DarrenN
DarrenN / get-npm-package-version
Last active Sep 25, 2021 — forked from yvele/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
View get-npm-package-version
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION