Starting state:
(1) ..s | [ int - int - int ] swap 'x set apply 'x get
Inferred Effect: [ ..s -- ..t ]
(2) ..s [ int - int - int ] | swap 'x set apply 'x get
Inferred Effect: [ ..s -- ..t ]
(3) ..s [ int - int - int ] x | 'x set apply 'x get
Inferred Effect: [ ..s x -- ..t ]
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
""" | |
The folloing code correctly tracks the change in | |
angle of the cursor. Factroing in crossing over | |
the boundery between 0 and 2PI. | |
""" | |
# Variable for storing previews positions | |
# Old angle is the original angle Godot | |
# will give. corrected_old_angle is the | |
# angle in the a range [0, 2pi). |
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
window.SugarCubeObject = class SugarCubeObject { | |
constructor() { | |
this.reviveWrapper = '(new ' + this.constructor.name + '())._init($ReviveData$)' | |
} | |
_init(obj) { | |
Object.keys(obj).forEach(pn => {this[pn] = clone(obj[pn])}); | |
return this; | |
} | |
clone () { |
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
# This is code to implement a text box. This | |
# was used in Godot <= 3.1 when rich text was still | |
# broken. | |
tool | |
extends PanelContainer | |
export (float, 0.0, 1.0, 0.001) var percent_visible := 1.0 setget set_percent_visible, get_percent_visible | |
export (String, MULTILINE) var text := "" setget set_text, get_text | |
export (int) var glyphs_per_line := 30 setget set_glyphs_per_line, get_glyphs_per_line |
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
func line_primitive_mesh(source_mesh: ArrayMesh) -> ArrayMesh: | |
# The first index is the vertex list of the mesh, the last index (-1) is the edges of the tris | |
# Edge data must exist for this function to work. Know to work fine with GLB files. | |
var vert_data = source_mesh.surface_get_arrays(0) | |
var verts = vert_data[0] | |
var edges = vert_data[-1] | |
var tris = PoolVector3Array() | |
# Reform the array so that PRIMITIVE_LINES correctly draws each tri of the mesh. | |
# The values A, B, C are the IDs of the vertext that make up some triangle |
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
! Copyright (C) 2022 Capital Ex. | |
! See http://factorcode.org/license.txt for BSD license. | |
USING: arrays fry io kernel math math.parser namespaces ranges | |
sequences sequences.deep syntax locals ; | |
IN: bresenham | |
<PRIVATE | |
: >x0,x1 ( p0 p1 -- x0 x1 ) |
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
require 'utf8' | |
local textBox = { | |
new = function(self, id,text, x, y, wrap, align, font, fontSize) | |
local tb = {} | |
tb.remove = false | |
tb.id = id | |
tb.font = font or love.graphics.getFont() | |
tb.fontHeight = tb.font:getHeight() | |
tb.fontSize = fontSize |
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
struct Red end | |
struct Yellow end | |
struct Green end | |
alias Color = Red | Yellow | Green | |
def take_red_green(xs : Array(Color)) : Array(Red | Green) | |
xs.select(Red | Green) | |
end | |
def expand_type(x : U, t : T.class) : U | T forall U, T |
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:english_words/english_words.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:provider/provider.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); |
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
class Heap<E> { | |
elem: E; | |
subheaps: Heap<E>[]; | |
constructor(elem: E = null, subheaps: Heap<E>[] = []) { | |
this.elem = elem; | |
this.subheaps = subheaps; | |
} | |
private setSize(size: number){ return this; } |