Skip to content

Instantly share code, notes, and snippets.

View veryjos's full-sized avatar
:octocat:
🤠 haha okay haha 🤠

veryjos veryjos

:octocat:
🤠 haha okay haha 🤠
View GitHub Profile
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);
class Heap {
constructor(comparator) {
this.elements = [];
this.end = -1;
this.cmp = comparator || ((a, b) => a - b);
}
getLeft(n) {
return (2 * (n + 1)) - 1;
}
/* 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.

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:

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.
///
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.
///
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.
@veryjos
veryjos / -
Created February 6, 2019 01:41
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.
@veryjos
veryjos / badge.js
Last active January 20, 2019 16:49
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;
use ash::vk::{ Format };
use std::convert::{ Into };
#[derive(Copy, Clone, Debug)]
struct ComponentMetadata {
size_bits: usize,
channel: char
}