Skip to content

Instantly share code, notes, and snippets.

View ascenderx's full-sized avatar
🐃
Evangelizing FOSS

Jimmy Downer ascenderx

🐃
Evangelizing FOSS
View GitHub Profile
@ascenderx
ascenderx / V8Example.java
Created February 14, 2020 05:22
Example J2V8 implementation (Debian Linux)
// Example derived from: https://eclipsesource.com/blogs/2015/06/06/registering-java-callbacks-with-j2v8/
// J2V8 is available at Maven Central: https://search.maven.org/search?q=g:com.eclipsesource.j2v8
// Compile:
// javac -cp j2v8_linux_x86_64-4.8.0.jar V8Example.java
// Run:
// java -cp ".:j2v8_linux_x86_64-4.8.0.jar" V8Example
import com.eclipsesource.v8.JavaVoidCallback;
@ascenderx
ascenderx / ExtractMCObjects.ps1
Last active December 30, 2021 05:59
Copy Minecraft objects to human-readable file paths
$version = "1.18"
$mc = "$env:APPDATA\.minecraft"
$jsonFile = "$mc\assets\indexes\$version.json"
$json = (Get-Content $jsonFile) -Join " "
$data = ConvertFrom-Json $json
$data.objects | Get-Member -MemberType NoteProperty | ForEach-Object {
$path = $_.Name
$hash = $data.objects."$path".hash
@ascenderx
ascenderx / index.html
Created April 28, 2020 03:04
Bouncing ball in box (JS for web)
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Bouncing ball in box</title>
<meta charset="UTF-8"/>
<link rel="stylesheet" href="styles.css"/>
</head>
<body>
<div class="meta-container">
<div class="canvas-container">
@ascenderx
ascenderx / complex.js
Last active May 16, 2020 04:23
Complex function graphing in JS for Web
function degToRad(degrees) {
return Math.PI * degrees / 180.0;
}
function radToDeg(radians) {
return 180.0 * radians / Math.PI;
}
class Complex {
constructor(r, i) {
@ascenderx
ascenderx / unicode-transformer.html
Last active May 23, 2020 01:50
Unicode homoglyph converter between Latin characters and letter-like symbols
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Unicode Text Transformer</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="theme-color" content="#000000"/>
<style>
* {
box-sizing: border-box;
@ascenderx
ascenderx / Profile.ps1
Created June 17, 2020 04:27
PowerShell Profile Script
#$HOME\Documents\WindowsPowerShell\
$esc = [char]27
$red = "$esc[1;31m"
$green = "$esc[1;32m"
$yellow = "$esc[1;33m"
$blue = "$esc[1;34m"
$magenta = "$esc[1;35m"
$cyan = "$esc[1;36m"
$default = "$esc[1;39m"
@ascenderx
ascenderx / csscolors.js
Last active November 23, 2020 05:35
Simple color selector
// Cloned from: https://raw.githubusercontent.com/bahamas10/css-color-names/master/css-color-names.json
const CSS_COLORS = {
"aliceblue": "#f0f8ff",
"antiquewhite": "#faebd7",
"aqua": "#00ffff",
"aquamarine": "#7fffd4",
"azure": "#f0ffff",
"beige": "#f5f5dc",
"bisque": "#ffe4c4",
@ascenderx
ascenderx / application.js
Created February 4, 2021 03:35
Canvas web app template
class CanvasApplication {
constructor(canvas) {
this._canvas = canvas;
this._graphics = canvas.getContext('2d');
this._timer = new AnimationTimer(
this._onTick.bind(this),
CanvasApplication._INTERVAL
);
this._inputHandler = new InputHandler();
}
@ascenderx
ascenderx / rainbow.ml
Created April 8, 2021 05:21
Simple rainbow in OCaml
#!/usr/bin/env ocaml
#load "graphics.cma"
#load "unix.cma"
open Graphics
open Printf
open Sys
open Unix
let display: string = getenv "DISPLAY"
@ascenderx
ascenderx / cache_my_images.rb
Last active May 14, 2021 06:07
Get Yu-Gi-Oh! card images using Ruby
#!/usr/bin/env ruby
require "json"
require "fileutils"
my_cards = nil
source_folder = "json"
source_file_name = "#{source_folder}/my_cards.json"
File.open(source_file_name) { |file|
my_cards = JSON.parse(file.read)