Skip to content

Instantly share code, notes, and snippets.

View FirstVertex's full-sized avatar
✌️
I write the code that makes the whole world sing

Hugh Anderson FirstVertex

✌️
I write the code that makes the whole world sing
View GitHub Profile
@FirstVertex
FirstVertex / 1_ExplodingOrbs_main.client.ts
Last active August 11, 2023 00:48
Roblox-ts Exploding Orbs
import { Players, ReplicatedStorage } from "@rbxts/services";
const player = Players.LocalPlayer;
const mouse = player.GetMouse();
const orbTemplate = ReplicatedStorage.FindFirstChild('Orb') as BasePart;
const inFrontOfPlayer = new CFrame(0, 0, -2);
const orbSpeed = new Vector3(0, 0, -120);
let hrp: BasePart | undefined = undefined;
@FirstVertex
FirstVertex / 1_timer.ts
Last active September 25, 2022 14:47
Lightlimn Roblox Timer module remixed for TypeScript by FirstVertex
import { RunService } from "@rbxts/services";
export class Timer {
constructor(private _duration: number, private _onComplete?: () => void, private _elapsed = 0, autoStart = true) {
if (autoStart) {
spawn(() => this.start());
}
}
private _paused: boolean = true;
@FirstVertex
FirstVertex / 1_ GrowScript.lua
Last active August 5, 2023 12:17
Roblox lua Grow-n-Shrink
local debounceTime = 3
local canTouch = true
script.Parent.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
if Humanoid and canTouch then
canTouch = false
local HD = Humanoid:GetAppliedDescription()
HD.HeadScale = HD.HeadScale * 2
HD.DepthScale = HD.DepthScale * 2
HD.WidthScale = HD.WidthScale * 2
@FirstVertex
FirstVertex / addAccessoryWithWeldConstraints.ts
Last active November 15, 2021 23:14
Roblox Accessories with WeldConstraints have problems. This fixes the shifting that happens when Accessories with welded parts are parented to the Character.
function addAccessoryWithWeldConstraints(humanoid: Humanoid, accessory: Accessory) {
const handle = accessory.FindFirstChild('Handle') as BasePart;
if (!handle) {
return;
}
humanoid.AddAccessory(accessory);
const os = handle.FindFirstChild('OriginalSize') as Vector3Value;
if (os) {
const sizeChange = handle.Size.div(os.Value);
handle.GetDescendants().forEach(desc => {
@FirstVertex
FirstVertex / input.scss
Created September 21, 2021 15:06
Generated by SassMeister.com.
$primary: #0a8287; // teal // use to add green
$secondary: #0e247e; // blue
.secondary-700 {
color: $secondary;
}
// target: #003865 00 38 65
.secondary-600 {
color: mix($primary, scale-color($secondary, $lightness: -10%, $saturation: -36%), 15%)
}
@FirstVertex
FirstVertex / input.scss
Created September 21, 2021 14:23
Generated by SassMeister.com.
$primary: #0a8287;
$secondary: #0e247e;
.secondary-700 {
color: $secondary;
}
// target: #003865 00 38 65
.secondary-600 {
color: mix($primary, scale-color($secondary, $lightness: 5%, $saturation: 5%), 15%)
}
@FirstVertex
FirstVertex / arrayBufferStream.ts
Created April 27, 2020 13:27
Create a stream from an ArrayBuffer
import * as Stream from 'stream';
class ArrayBufferStream extends Stream.Readable {
constructor(private _arrayBuffer: ArrayBuffer, opts?: Stream.ReadableOptions) {
super(opts);
}
private _chunk_size = 1024 * 16;
private _pointer = 0;
@FirstVertex
FirstVertex / bootstrap-custom-columns.css
Last active October 7, 2020 13:19
Bootstrap Grid with column widths in 10ths and 8ths
/* custom bootstrap grid by Hugh Anderson */
.col-xs-110 { width: calc(100% / 10) } /* 1/10 */
.col-xs-18 { width: calc(100% / 8) } /* 1/8 */
.col-xs-15 { width: calc(100% / 5) } /* 1/5 */
.col-xs-38 { width: calc(300% / 8) } /* 3/8 */
.col-xs-310 { width: calc(300% / 10) } /* 3/10 */
.col-xs-25 { width: calc(200% / 5) } /* 2/5 */
.col-xs-35 { width: calc(300% / 5) } /* 3/5 */
.col-xs-58 { width: calc(500% / 8) } /* 5/8 */
@FirstVertex
FirstVertex / Select2 with Primary selected item - 4_styles.css
Last active August 29, 2015 14:26
Select2 with Primary selected item 4/4
/* http://www.cssportal.com/css-gradient-generator/ */
.select2-container-multi .select2-choices .select2-search-choice.select2-primary {
background-color: green;
border-color: green;
background-image: -ms-linear-gradient(top, #5CBD73 0%, #79EF70 50%, #24E23D 51%, #1F9C49 100%);
background-image: -moz-linear-gradient(top, #5CBD73 0%, #79EF70 50%, #24E23D 51%, #1F9C49 100%);
background-image: -o-linear-gradient(top, #5CBD73 0%, #79EF70 50%, #24E23D 51%, #1F9C49 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #5CBD73), color-stop(50, #79EF70), color-stop(51, #24E23D), color-stop(100, #1F9C49));
background-image: -webkit-linear-gradient(top, #5CBD73 0%, #79EF70 50%, #24E23D 51%, #1F9C49 100%);
background-image: linear-gradient(to bottom, #5CBD73 0%, #79EF70 50%, #24E23D 51%, #1F9C49 100%);
@FirstVertex
FirstVertex / Select2 with Primary selected item - 1_markup.html
Last active August 29, 2015 14:26
Select2 with Primary selected item 1/4
<label for="Troops">Troops</label>
<select name="Troops" id="Troops" multiple="" class="primary-selectable">
<option value="1">Barbarian</option>
<option value="2">Archer</option>
<option value="3">Goblin</option>
<option value="4">Giant</option>
<option value="5" selected="selected">Wall Breaker</option>
<option value="6">Balloon</option>
<option value="7" selected="selected">Wizard</option>
<option value="8">Healer</option>