Skip to content

Instantly share code, notes, and snippets.

View perjo927's full-sized avatar
🧑‍💻

Per Jonsson perjo927

🧑‍💻
  • DevCode
  • Stockholm, Sweden
View GitHub Profile

Next-generation JavaScript frameworks

Web application frameworks have been developing fast in the past few years, and as the technologies that they're built on top of get more advanced, each of these frameworks is able to provide newer features to help developers build more complex applications. This year, we've seen the release of a new class of application frameworks that takes advantage of JavaScript's ability to be both on the client and the server. What this allows these frameworks to do is provide both a new level of abstraction by sharing code between client and server, as well as embrace the benefits of both client-side rendering and server-side rendering.

For the end user, they get smooth, desktop-like responsiveness from client-side rendering, while still being able to maintain the SEO and accessbility benefits of server-side rendering. For developers, that means writing less boilerplate code, and being able to focus more on writing the application logic.

Today, there are three main framew

@perjo927
perjo927 / imperialmarch.ino
Created April 8, 2018 17:24
Imperial march from Star Wars for Zumo Robot Buzzer
#include <Wire.h>
#include <Zumo32U4.h>
Zumo32U4Buzzer buzzer;
const char march[] PROGMEM =
"! O2 T100 MS"
"a8. r16 a8. r16 a8. r16 f8 r16 >c16"
"ML"
"a8. r16 f8 r16" "MS" ">c16 a. r8"
@perjo927
perjo927 / CssUtils.ts
Last active April 29, 2018 14:13
Media query hacks for weird browsers (React+Styled Components)
// cssUtils.ts
import { css } from "styled-components";
export const IEOnly: Function = style => {
return css`
@media all and (-ms-high-contrast:none) {
*::-ms-backdrop, & {
${style};
}
`;
@perjo927
perjo927 / HoverSupported.css
Last active November 10, 2022 16:17
CSS: Support hover only on non-touch devices using media query
/*
* Compiled CSS:
*/
a {
color: green;
}
@media not all and (pointer: coarse) {
a:hover {
color: blue;
}
@perjo927
perjo927 / gitbot.ps1
Last active July 29, 2018 09:21
A git bot for Windows.
<#
Gitbot
Makes Your Git Stats Great
#>
param([string]$path="C:\")
function GenerateName {
$filepath = Resolve-Path "words.txt"
$raw = Get-Content -Path $filepath
@perjo927
perjo927 / compose.test.js
Last active September 8, 2020 08:55
Proof for function composition
import assert from "assert";
const compose = (...functions) => (initialArg) =>
functions.reduceRight(
(accumulatedValue, func) => func(accumulatedValue),
initialArg
);
describe("compose", () => {
it("returns a composed function h, so that h(x) is equal to f(g(x))", () => {
@perjo927
perjo927 / index.html
Created September 7, 2020 17:15
Todo App Starter
<html>
<head>
<title>Todo App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="./index.js"></script>
</body>
</html>
import { makeStateHandlers } from "../src/redux/store/state.js";
import assert from "assert";
describe("state.js", () => {
describe("makeStateHandlers", () => {
it("generates two functions from a state container input", () => {
const stateContainer = [{ state: "state" }];
const stateHandlers = makeStateHandlers(stateContainer);
@perjo927
perjo927 / dispatch.js
Created September 8, 2020 07:06
Make dispatcher
export const makeDispatcher = (stateHandlers, reducer, onDispatch) => ({
dispatch(action) {
const { getState, setState } = stateHandlers;
const state = getState();
const newState = reducer(state, action);
setState(newState);
onDispatch();
@perjo927
perjo927 / state.js
Last active September 8, 2020 13:19
Make state handlers
export const makeStateHandlers = (stateContainer) => ({
getState() {
const [lastState] = stateContainer.slice(-1);
return lastState;
},
setState(newState) {
return stateContainer.push(newState);
},
});