Skip to content

Instantly share code, notes, and snippets.

@dan-dr
dan-dr / chatter.md
Last active July 9, 2022 22:59
chatter README

Chatter Coding Challenge 🤖   hard time

 

Goals / Outcomes ✨

  • To test knowledge of using sockets (socket.io) and events
  • Understanding of callbacks, hooks and function references

 

Pre-requisites ✅

None

@dan-dr
dan-dr / badhtml.js
Created May 16, 2019 18:13
Validate HTML and save to markdown table
"use strict"
const glob = require("glob")
const fs = require("fs")
function unwrap(str) {
let arr = str.split(","),
val,
o = {}
while ((val = arr.pop())) {
@dan-dr
dan-dr / index.js
Created March 28, 2019 21:23
Sanity Backup to Dropbox on webtask.io
const sanity = require('@sanity/client')
const fs = require('fs')
const EOL = require('os').EOL
const flatMap = require('lodash.flatmap')
const { subDays, isBefore } = require('date-fns')
const sanityExport = require('@sanity/export')
/**
* @param context {WebtaskContext}
*/
@dan-dr
dan-dr / ace.md
Last active September 17, 2023 15:13
Use Ace Engine to stream to vlc (and maybe chromecast)

Make sure you installed Ace Stream media 3.1 from http://www.acestream.org/

  1. Open "Ace Stream Media Center"
  2. Go to http://127.0.0.1:6878/webui/app/XBsF06CtbkkB/server#proxy-server-add-item
  3. Give it a title
  4. In CONTENT-ID put the acestream content id
  5. Click ADD-TO-PLAYLIST
  6. If it doesn't move you to a new screen go to http://127.0.0.1:6878/webui/app/XBsF06CtbkkB/server#proxy-server-playlist
  7. Now there's a list with a row with your title (should be the only one if it's your first time)
  8. Click the arrow next to play in the list and choose VLC or the chromecast device (chromecast not working for me yet)
@dan-dr
dan-dr / index.html
Last active September 20, 2019 01:09
Netlify formData object from value
<form>
<input type="text" name="cities[]" /> <!-- for arrays and objects. don't enumerate/propertize in markup. yes i just invented propertize -->
</form>
webpack: (config, { stage, defaultLoaders }) => {
/*
* TypeScript Support
* */
// Add .ts and .tsx extension to resolver
config.resolve.extensions.push('.ts', '.tsx')
// Add TypeScript Path Mappings (from tsconfig via webpack.config.js)
// to react-statics alias resolution
@dan-dr
dan-dr / .zshrc
Last active July 26, 2021 22:44
Kill webpack-dev-server with babun on windows
# usage: killwebpack [port]
# if no port is supplied then default port is 3000
function killwebpack() {
PORT=3000
if [ -n "$1" ]
then
PORT=$1
fi
@dan-dr
dan-dr / bookmarklet
Last active April 26, 2018 12:12
Find m3u8 streams for streamlink bookmarklet
javascript:(function (d) {
function guid() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
}
@dan-dr
dan-dr / PointInPolygon.java
Last active October 22, 2015 15:05
check if point is within polygon
class Boundary {
private final Point[] points; // Points making up the boundary
...
/**
* Return true if the given point is contained inside the boundary.
* See: http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
* @param test The point to check
* @return true if the point is inside the boundary, false otherwise