First, an exercise. Can we represent all of css with plain data? Let's try.
let redText = { color: 'red' };
//@version=4 | |
study(title="CTO Line", shorttitle="CTO", overlay=true, resolution="") | |
smma(src, length) => | |
smma = 0.0 | |
smma := na(smma[1]) ? sma(src, length) : (smma[1] * (length - 1) + src) / length | |
smma | |
v1 = smma(hl2, 15) | |
m1 = smma(hl2, 19) | |
m2 = smma(hl2, 25) | |
v2 = smma(hl2, 29) |
import * as path from "https://deno.land/[email protected]/path/mod.ts"; | |
import * as fs from "https://deno.land/[email protected]/fs/mod.ts"; | |
import { paramCase } from "https://deno.land/x/[email protected]/mod.ts"; | |
const cwd = Deno.cwd(); | |
// Files to be excluded during the walk | |
const skip = (await Deno.readTextFile(path.join(cwd, ".gitignore"))) | |
.replace(/#.*/g, "") | |
.replace(/\s*\n/g, "\n") |
import { useState, useMemo, useEffect } from "react"; | |
import { interpret } from "xstate/lib/interpreter"; | |
export default function useMachine(machine, { log = false } = {}) { | |
const [current, setCurrent] = useState(machine.initialState); | |
const service = useMemo(() => interpret(machine), []); | |
useEffect(() => { | |
service.onTransition(setCurrent).start(); |
export class MyComponent extends React.Component { | |
componentWillMount() { | |
const styleid = 'MyComponentStyles' | |
if (document.head.querySelector(`#${styleid}`) !== null) { | |
const styles = document.createElement('style'); | |
styles.id = styleid; | |
styles.append('[foo]{ color: blue; }'); | |
document.head.appendChild(styles); | |
} | |
} |
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
import { connect } from 'react-redux'; | |
import { | |
extractClockTimestamp, | |
} from './reduxClockReducer'; | |
import { | |
ACTION_CLOCK_SUBSCRIBE, |
/* | |
New Relic GPT ad monitoring code | |
// | |
This snippet captures PageActions containing references to Google publisher tag ads | |
Should you have any questions about this, please reach out to me at [email protected] | |
Please note that you must be using New Relic's SPA browser agent. | |
// | |
*/ | |
// | |
//first, make sure the newrelic object exists properly |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
The following guide will show you how to deploy a simple microservice written in JavaScript using 𝚫 now.
It uses Open Source tools that are widely available, tested and understood: