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
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 { |
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
const print = @import("std").debug.print; | |
var enable_ansi_colors = true; | |
// Valid colors: | |
// <black> | |
// <blue> | |
// <cyan> | |
// <green> | |
// <magenta> | |
// <red> |
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
const tester = @import("../test/tester.zig"); | |
const std = @import("std"); | |
threadlocal var parser_join_input_buffer: [1024]u8 = undefined; | |
threadlocal var parser_buffer: [1024]u8 = undefined; | |
// This function is based on Node.js' path.normalize function. | |
// https://github.com/nodejs/node/blob/36bb31be5f0b85a0f6cbcb36b64feb3a12c60984/lib/path.js#L66 | |
pub fn normalizeStringGeneric(str: []const u8, buf: []u8, comptime allow_above_root: bool, comptime separator: u8, comptime isPathSeparator: anytype, lastIndexOfSeparator: anytype) []u8 { |
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
const std = @import("std"); | |
const Wyhash = std.hash.Wyhash; | |
const FixedBufferAllocator = std.heap.FixedBufferAllocator; | |
const HashKeyType = u64; | |
const IndexMap = std.HashMapUnmanaged(HashKeyType, u32, hash_hashFn, hash_eqlFn, 80); | |
pub const Result = struct { | |
hash: HashKeyType, |
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
fn expectPrinted(t: *Tester, contents: string, expected: string, src: anytype) !void { | |
// ... | |
_ = t.expect(contents, copied, src); | |
} | |
test "test name" { | |
var t_ = Tester.t(std.heap.page_allocator); | |
var t = &t_; | |
try expectPrinted(t, "(-x) ** 2", "(-x) ** 2;\n", @src()); |
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 {TSMeasureResult} from 'react-native-text-size'; | |
import memoizee from 'memoizee'; | |
import {NativeModules} from 'react-native'; | |
import {LocationPermissionStatus, Location} from 'react-native-location'; | |
import {isEmpty} from 'lodash'; | |
import {LocationButton} from '../components/LocationButton'; | |
import {GeocodeLocation} from './GeocodeLocation'; | |
import {getBoundByRegion} from './getBoundByRegion'; | |
const TextSize = NativeModules.RNTextSize; |
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
const addImports = require("jscodeshift-add-imports"); | |
module.exports = function (fileInfo, api, options) { | |
const j = api.jscodeshift; | |
const code = fileInfo.source; | |
const root = j(code); | |
addImports(root, [j.template.statement`import * as React from 'react'`]); | |
return root.toSource(); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Untitled benchmark</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
// | |
// 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> |