Skip to content

Instantly share code, notes, and snippets.

View nathanchase's full-sized avatar
👨‍💻
Developing the future

Nathan Chase nathanchase

👨‍💻
Developing the future
View GitHub Profile
@mattbell87
mattbell87 / remote-wsl.md
Last active September 12, 2024 08:00
VSCode Remote: Connect to WSL2 from another machine

VSCode Remote: Connect to WSL2 from another machine

Do you want to do remote development on your WSL2 container in Visual Studio Code? Read this.

Proxy jump method

  1. On the host set up OpenSSH for Windows
  2. Run wsl --update to make sure you are running the latest WSL
  3. Open WSL and install another SSH server inside WSL with sudo apt-get install openssh-server
  4. Now run sudo systemctl enable --now ssh to automatically start ssh when WSL starts.
@cesasol
cesasol / buefy.js
Created October 9, 2018 20:07
Treeshakeable buefy on nuxt
/**
* This is a plugin for nuxtjs to import only what you need from buefy
* works on nuxt 2.1.0 and buefy 0.7.0
*/
import Vue from 'vue'
import Autocomplete from '~/libs/buefy/components/autocomplete/Autocomplete.vue'
import Checkbox from '~/libs/buefy/components/checkbox/Checkbox.vue'
import CheckboxButton from '~/libs/buefy/components/checkbox/CheckboxButton.vue'
@svdoever
svdoever / youtube2mp4.js
Created June 1, 2018 21:36
NodeJS Express service to convert YouTube url to mp4 url
const axios = require('axios');
const express = require('express');
// from https://codewithmark.com/learn-to-create-youtube-video-downloader
function qsToJson(qs) {
var res = {};
var pars = qs.split('&');
var kv, k, v;
for (i in pars) {
kv = pars[i].split('=');
@DreaMinder
DreaMinder / A Nuxt.js VPS production deployment.md
Last active July 31, 2024 13:56
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with nuxt@2.3. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@valichek
valichek / main.js
Last active October 8, 2017 22:33
Aurelia Webpack basic config (jquery, bootstrap, i18n, validation)
var Promise = require('bluebird'); // Promise polyfill for IE11
// Bluebird config
Promise.config({
// Enable warnings
warnings: true,
// Enable long stack traces
longStackTraces: true,
// Enable cancellation
cancellation: false,
// Enable monitoring
@mujimu
mujimu / aurelia_selectize.txt
Last active November 21, 2017 22:43
Aurelia + selectize multiselect
# start with es2016 skeleton
jspm install jquery
jspm install selectize
@monkeyhouse
monkeyhouse / install + aurelia.json mods
Last active July 29, 2018 22:14
aurelia selectize simple custom element
npm install selectize - save
npm install jquery -save
add this to the aurelia.json file in the dependencies section of the vendor bundle
"jquery",
{
"name": "selectize",
"path": "../node_modules/selectize/dist",
@asafh
asafh / pairs.js
Last active October 5, 2021 23:49
Ranked Pair voting
/**
* Runs electSingle until at least *wanted* winners are elected, returns the first *wanted* winners.
* @param candidates see electSingle
* @param getScore see electSingle
* @param ballots see electSingle
* @param wanted the number of wanted winners
* @returns [candidate] Array of candidates of size *wanted* (given that there are enough candidates)
*/
function elect(candidates, getScore, ballots, wanted) {
if(typeof wanted !== "number") {