A Pen by Benjamin Kayode on CodePen.
This file contains hidden or 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 Interpreter() { | |
this.scopeStack = [{}]; | |
this.functions = {}; | |
} | |
const operators = ['+', '-', '/', '*', '%', '=', '=>', ')']; | |
Interpreter.prototype.tokenize = function (program) { | |
if (program === "") return []; |
This file contains hidden or 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 Compiler () { | |
}; | |
Compiler.prototype.compile = function (program) { | |
return this.pass3(this.pass2(this.pass1(program))); | |
}; | |
Compiler.prototype.tokenize = function (program) { | |
// Turn a program string into an array of tokens. Each token | |
// is either '[', ']', '(', ')', '+', '-', '*', '/', a variable |
This file contains hidden or 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
ws = _{ " " | "\t" } | |
wsln = _{ ws | "\n" } | |
COMMENT = _{ "/*" ~ (!"*/" ~ ANY)* ~ "*/" | "//" ~ (!"\n" ~ ANY)* ~ "\n"+ } | |
Program = _{ SOI ~ wsln* ~ (Stmt ~ wsln*)* ~ Stmt? ~ EOI } | |
Stmt = { AssignmentExpr | ForExpr } | |
Identifier = @{ ASCII_ALPHA ~ (ASCII_ALPHANUMERIC | "_")* } |
This file contains hidden or 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 healthCheck(req, res) { | |
const { runAll,ㅤ} = req.body | |
const healthCheckScripts = [ | |
"ping mysql-service.com:3306", | |
"ping google.com",ㅤ | |
]; | |
// Assume exec is some function that executes commands on the shell | |
healthCheckScripts.forEach(check => { |
This file contains hidden or 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 java.security.KeyFactory | |
import java.security.spec.PKCS8EncodedKeySpec | |
import java.security.spec.X509EncodedKeySpec | |
import java.util.* | |
import javax.crypto.Cipher | |
object RSA { | |
private val encoder = Base64.getEncoder() | |
private val decoder = Base64.getDecoder() |
This file contains hidden or 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 java.util.* | |
import javax.crypto.Cipher | |
import javax.crypto.SecretKeyFactory | |
import javax.crypto.spec.IvParameterSpec | |
import javax.crypto.spec.PBEKeySpec | |
import javax.crypto.spec.SecretKeySpec | |
object AES { | |
private val encoder = Base64.getEncoder() |
This file contains hidden or 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 { atom } from "recoil"; | |
export const historyState = atom({ | |
key: "historyState", | |
default: [] | |
}); |
This file contains hidden or 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 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override |
NewerOlder