Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
🤠 haha okay haha 🤠

veryjos veryjos

:octocat:
🤠 haha okay haha 🤠
  • California
View GitHub Profile
View doubleItrGen.js
function* dfs(node) {
if (!node) return;
if (node.type === 'text') {
for (const ch of node.val) {
yield ch;
}
}
for (const child of (node.children || [])) {
yield *dfs(child);
View heap.js
class Heap {
constructor(comparator) {
this.elements = [];
this.end = -1;
this.cmp = comparator || ((a, b) => a - b);
}
getLeft(n) {
return (2 * (n + 1)) - 1;
}
View robot-room-cleaner.js
/* Robot Room Cleaner
*
* [Hard] [AC:65.6% 27.9K of 42.6K]
* [filetype:javascript]
*
* Given a robot cleaner in a room modeled
* as a grid.
*
* Each cell in the grid can be empty or
* blocked.
View keybase.md

Keybase proof

I hereby claim:

  • I am veryjos on github.
  • I am veryjos (https://keybase.io/veryjos) on keybase.
  • I have a public key whose fingerprint is 202C 9453 F507 E360 EA3F E5C3 72F7 1284 FED6 88F5

To claim this, I am signing this object:

View sync_cell.rs
use std::mem::{MaybeUninit, transmute_copy};
use std::marker::Send;
use std::sync::atomic::AtomicPtr;
/// Size of the buffer used for the underlying circular buffer.
const BUFFER_SIZE: usize = 16;
/// An unsafe, lockless cell which is syncronized across threads.
///
View sync_cell.rs
use std::mem::{MaybeUninit, transmute_copy};
use std::marker::Send;
use std::sync::atomic::AtomicPtr;
/// Size of the buffer used for the underlying circular buffer.
const BUFFER_SIZE: usize = 16;
/// A cell which is syncronized across threads.
///
View sync_cell.rs
use std::mem::{MaybeUninit, transmute};
use std::marker::Send;
use std::sync::Arc;
use std::sync::atomic::AtomicPtr;
/// Size of the buffer used for the underlying circular buffer.
const BUFFER_SIZE: usize = 16;
/// A cell which is syncronized across threads.
View -
use std::marker::Send;
use std::sync::atomic::AtomicPtr;
/// Size of the buffer used for the underlying circular buffer.
const BUFFER_SIZE: usize = 16;
/// A cell which is syncronized across threads.
///
/// When a reader requests the data held by this cell, the most recently
/// written data will be given to the reader.
View badge.js
import React from 'react';
import { Flex } from 'rebass';
import styled from 'styled-components';
import * as widgets from 'components/widgets'
const BadgeFlex = styled(Flex)`
width: 500px;
height: 50px;
View pixel_format.rs
use ash::vk::{ Format };
use std::convert::{ Into };
#[derive(Copy, Clone, Debug)]
struct ComponentMetadata {
size_bits: usize,
channel: char
}