This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pathToFileURL } from 'url'; | |
import { transformAsync } from '@babel/core'; | |
const baseURL = pathToFileURL(`${process.cwd()}/`).href; | |
const extensionsRegex = /\.jsx$/; | |
const supportedModuleFormats = ['module', 'commonjs']; | |
const babelOptions = { | |
presets: [ | |
['@babel/preset-react'] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function csv2json(csv) { | |
const headerEndIndex = csv.indexOf('\r\n'); | |
const bodyStartIndex = headerEndIndex + 2; | |
const headers = csv.substring(0, headerEndIndex).split(';'); | |
const body = csv.substring(bodyStartIndex).split('\r\n').map(line => line.split(';')); | |
const data = body.map(item => { | |
const object = {}; | |
headers.forEach((header, index) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The basics */ | |
.scroll-container { | |
overflow: auto; | |
scrollbar-width: thin; | |
scrollbar-color: hsl(0 0% 50%); | |
/* postcss-scrollbar will add the -webkit version automatically! */ | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function createElement(tag, props, ...children) { | |
const element = document.createElement(tag); | |
if (props) { | |
Object.entries(props).forEach(([key, value]) => { | |
if (key.startsWith('on') && typeof value === 'function') { | |
element.addEventListener(key.substring(2), value); | |
} else if (key.startsWith('data-')) { | |
element.setAttribute(key, value); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const request = require('request'); | |
const jwt = require('jsonwebtoken'); | |
const ZOOM_API_URL = 'https://api.zoom.us/v2/'; | |
function getToken(key, secret) { | |
return jwt.sign({ | |
iss: key, | |
exp: Math.floor(Date.now() / 1000) + 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mixin mdc-spinner | |
svg.mdc-spinner( | |
xmlns='http://www.w3.org/2000/svg' | |
viewBox='0 0 66 66' | |
class={ | |
'mdc-spinner--colorful': attributes.colorful | |
} | |
)&attributes(attributes) | |
circle.mdc-spinner__circle(cx='33' cy='33' r='30') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$todo | |
import {transform, registerPlugin, availablePlugins} from '@babel/standalone' | |
export type BabelPlugin = string | [string, any] | |
function writeStuckFlag(stuck: boolean) { | |
try { | |
localStorage.setItem('runtime/stuck', JSON.stringify(stuck)) | |
} catch (err) {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from 'express'; | |
import request from 'request'; | |
export default ({ | |
config: { | |
GITHUB_CLIENT_ID, | |
GITHUB_CLIENT_SECRET, | |
GITHUB_REDIRECT_URI | |
}, | |
models: { User } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const https = require('https'); | |
const ssl = { | |
key: fs.readFileSync(__dirname + '/ssl/codedojo.pem'), | |
cert: fs.readFileSync(__dirname + '/ssl/codedojo.crt') | |
}; | |
https.createServer(ssl, server).listen(server.get('port'), 'codedojo.dev', () => { | |
console.log('Express server listening on port ' + server.get('port')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const people = [ | |
{ | |
department: "Directing", | |
id: 20561, | |
job: "Director", | |
name: "James Gray" | |
}, | |
{ | |
department: "Writing", | |
id: 20561, |
NewerOlder