Skip to content

Instantly share code, notes, and snippets.

//
// YeetJSIUTils.h
// yeet
//
// Created by Jarred WSumner on 1/30/20.
// Copyright © 2020 Facebook. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <jsi/jsi.h>
const std = @import("std");
pub fn preallocate_file(fd: std.os.fd_t, offset: std.os.off_t, len: std.os.off_t) void {
_ = std.os.linux.fallocate(fd, 0, @intCast(i64, offset), len);
}
pub fn main() anyerror!void {
const argv = std.process.argsAlloc(std.heap.c_allocator) catch unreachable;
if (argv.len < 3) {
std.log.warn("Usage: {s} <length> <file> [--preallocate]\n", .{argv[0]});
@Jarred-Sumner
Jarred-Sumner / comcast.js
Last active September 7, 2022 01:30
Comcast injects this into webpages to show copyright notices
// Comcast Cable Communications, LLC Proprietary. Copyright 2014.
// Intended use is to display browser notifications for critical and time sensitive events.
var _ComcastAlert = (function(){
return {
SYS_URL: '/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/notify.do'
, dragObj: {zIndex: 999999}
, browser: null
, comcastCheck: 1
, comcastTimer: null
, xmlhttp: null
const std = @import("std");
// usage:
// ./file-path:0 10
// 1 2 3
// 1. file path
// 2. Byte offset in file
// 3. ms update interval
pub fn main() anyerror!void {
import logo from "./logo.svg";
import "./App.css";
function App() {
const ms = Date.now() - parseInt(window.location.search.substring(1), 10);
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h3>Loaded in {ms}ms.</h3>
//go:generate go-enum -f=$GOFILE --marshal
// originally a fork of https://github.com/blang/semver iirc
package node_semver
import (
"math"
"math/bits"
"sort"
"strconv"
"strings"
pub fn eqlComptime(self: string, comptime alt: anytype) bool {
switch (comptime alt.len) {
0 => {
@compileError("Invalid size passed to eqlComptime");
},
2 => {
const check = comptime std.mem.readIntNative(u16, alt[0..alt.len]);
return self.len == alt.len and std.mem.readIntNative(u16, self[0..2]) == check;
},
const std = @import("std");
const Api = @import("./api/schema.zig").Api;
usingnamespace @import("./global.zig");
/// QueryString array-backed hash table that does few allocations and preserves the original order
pub const QueryStringMap = struct {
allocator: *std.mem.Allocator,
slice: string,
buffer: []u8,
list: Param.List,
// AUTO-GENERATED
#pragma once
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#define ZIG_DECL extern
#define CPP_DECL extern
#pragma mark - JSC::JSObject