Skip to content

Instantly share code, notes, and snippets.

@Dornhoth
Dornhoth / index.js
Created April 5, 2020 17:45
WebRTC with Screen Sharing
(function () {
"use strict";
const MESSAGE_TYPE = {
SDP: 'SDP',
CANDIDATE: 'CANDIDATE',
}
let code;
let peerConnection;
# ---- Base Node ----
FROM mhart/alpine-node:10 AS base
# install node
RUN apk add --no-cache nodejs-current
# set working directory
WORKDIR /root/nextApp
# copy project file
COPY package.json .
COPY tsconfig.server.json .
COPY .npmrc .
@a-barbieri
a-barbieri / README.md
Last active June 6, 2021 21:48
NextJS sitemap generator with dynamic URL

NextJS sitemap generator

Install

The current setup has been tested on Next Js 7.0.0.

You need to install Axios.

$ npm install axios
@edolyne
edolyne / server.js
Created August 6, 2018 15:24
Dynamic Sitemap creation for NextJS based projects
const express = require('express');
const next = require('next');
const sm = require('sitemap');
const axios = require('axios');
const port = parseInt(process.env.PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();
@miguelmota
miguelmota / remove_tuxera.sh
Last active May 26, 2024 20:00
Completely uninstall and remove Tuxera NTFS on MacOS (resets trial version)
sudo rm -rf /Applications/Tuxera\ Disk\ Manager.app
sudo rm -rf /Library/Application\ Support/Tuxera\ NTFS
sudo rm -rf /Library/Filesystems/fusefs_txantfs.fs

How to set up a NodeJS website with Authentication and Back office (and Blog)

In this tutorial we're going to build a NodeJS website with the following features:

  • User authentication
  • Back office
  • Blog (optional)

The first to parts of the tutorial are meant to quickly set you up and running. The third part is a more in depth explanation of some points I find important, so feel free to read them later as you need.

@mjangda
mjangda / ngrok-and-jetpack.md
Last active February 7, 2023 07:57
How to connect ngrok to your local WordPress environment (props @DanReyLop)

How to develop with Jetpack locally with ngrok

To connect Jetpack in your local installation, you'll need a way for WP.com servers to reach your server. That can be done in a number of different ways:

  • You can open your router's ports and use your public IP
  • You can use some kind of Dynamic DNS provider.

But these options fall short of ngrok, which is a "localhost tunnel". It basically allows the Internet to hit a local port on your machine without worrying about ports or IPs.

As long as ngrok is running, Jetpack / WP.com will be able to communicate with your local site. This will allow remote modules like Site Search and Manage to work.

@trevanhetzel
trevanhetzel / table-sorting.js
Created June 14, 2017 03:21
Simple table sorting for dates, strings & integers w/ jQuery & ES6
/**
* Custom table sorting
*/
import $ from 'jquery';
export default {
// Set this opposite to what the default ordering is
DESC: false,
@detrohutt
detrohutt / initClient.js
Last active January 23, 2020 02:21
zeit/next.js/examples/with-apollo/lib/initClient.js -- changed to support subscriptions
import { ApolloClient, createNetworkInterface } from 'react-apollo'
import { SubscriptionClient, addGraphQLSubscriptions } from 'subscriptions-transport-ws'
const uri = 'http://localhost:4000/graphql'
const subscriptionsURI = 'ws://localhost:4000/'
let apolloClient = null
function _initClient (headers, initialState, subscriptionsInterface) {
return new ApolloClient({
initialState,
@peggyrayzis
peggyrayzis / .babelrc
Last active February 7, 2019 03:31
Webpack 2 + PWA support (Tree Shaking, Code Splitting w/ React Router v4, Service Worker)
{
"presets": [
"react",
"stage-2",
[
"env",
{
"targets": {
"browsers": [
"last 2 versions",