Skip to content

Instantly share code, notes, and snippets.

View image72's full-sized avatar

image72 image72

View GitHub Profile
@krnlde
krnlde / promisify-http.js
Last active February 22, 2023 03:42
util.promisify.custom and http.get example
const http = require('http');
const {promisify} = require('util');
http.get[promisify.custom] = function getAsync(options) {
return new Promise((resolve, reject) => {
http.get(options, (response) => {
response.end = new Promise((resolve) => response.on('end', resolve));
resolve(response);
}).on('error', reject);
});
@eirikb
eirikb / load-vue-components-from-folder.js
Created May 24, 2017 19:24
Load all Vue components from a given folder, no need for an "index.js"-file
const req = require.context('./components/', true, /\.(js|vue)$/i);
req.keys().map(key => {
const name = key.match(/\w+/)[0];
return Vue.component(name, req(key))
});
(From http://renebakx.nl/7/running-a-local-wildcard-dns-server-on-your-mac/)
Update for mavericks (10.9)
Named and bind are not packaged by default anymore, however the good people of menandmice provide a pre-compiled binary that saves you a lot of compiling with homebrew :)
Just go to http://support.menandmice.com/download/bind/macosx/10.9-Mavericks/ and download the ISCBIND-9.9.4-x86_64-10.9.zip package.
Unzip it, and you get a folder called __Parent__ with a subfolder called __Parent__ and the package called ISCBIND-9.9.4-x86_64-10.9.mpkg double click to install and follow the instructions down below
@cschiewek
cschiewek / x11_docker_mac.md
Last active March 25, 2025 13:23
X11 in docker on macOS

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@wbchn
wbchn / webdav.sh
Created April 7, 2017 08:27
webdav mount scripts
#!/bin/sh
[ $# -ne '4' ] && echo -e "Usage:\n bash $0 [WebDAV] [User] [Password] [MountPath]" && exit 1
WebDAV="$1"
User="$2"
Pwd="$3"
WebMount="$4"
apt-get install -y -qq davfs2 fuse-utils libneon27-gnutls
[ $? -ne '0' ] && echo "Install davfs2 fail! " && exit 1
mkdir -p "$WebMount"
rm -rf /etc/davfs2/davfs2.conf
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active April 19, 2025 01:52
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
anonymous
anonymous / index.html
Created March 22, 2017 07:31
Jiachun-li // source https://jsbin.com/luzeti
<!DOCTYPE html>
<!-- saved from url=(0032)http://jiachun-li.com/#portfolio -->
<html lang="en"><!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<title>Jiachun-li</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
@bryanrsmith
bryanrsmith / _error.js
Last active June 25, 2021 15:32
Next.js custom error handler that doesn't display for errors encountered on initial client render
import React, { PropTypes } from 'react';
import Head from 'next/head';
import Router from 'next/router';
// Script errors occuring during initial client render can cause the server-rendered
// content to be hidden by an error page. Track router events to determine if the
// error being handled happened during initial render, and throw within
// getInitialProps to allow the server-rendered content to remain visible.
const isClient = typeof window !== 'undefined';
let isInitialClientRender = isClient;
@kripken
kripken / hello_world.c
Last active March 19, 2025 06:14
Standalone WebAssembly Example
int doubler(int x) {
return 2 * x;
}