This file contains 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
use std::io::{self, Write}; | |
struct Memory { | |
cells: Vec<i32>, | |
pointer: usize, | |
} | |
fn bf_runtime(m: &mut Memory, s: String) { | |
let instructions: &[u8] = s.as_bytes(); | |
let mut idx: usize = 0; |
This file contains 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Copyright (c) Rich Hickey. All rights reserved. | |
;; | |
;; The use and distribution terms for this software are covered by the | |
;; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
;; which can be found in the file CPL.TXT at the root of this distribution. | |
;; By using this software in any fashion, you are agreeing to be bound by | |
;; the terms of this license. | |
;; | |
;; You must not remove this notice, or any other, from this software. |
This file contains 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 { useRef } from "react"; | |
export default function useThrottle(callback, delay) { | |
const savedTimer = useRef(null) | |
function execCallback(...args) { | |
// Create a timeout and block other calls until this callback is resolved | |
savedTimer.current = setTimeout(() => { | |
if (typeof callback === "function") { | |
callback(...args) |
This file contains 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
/** | |
* UI to select any element on the webpage using the mouse, | |
* and print to console the exact selector of the DOM element. | |
* | |
* Inspired by Firefox Screenshot | |
* | |
* Live Version: | |
* https://codesandbox.io/s/dom-element-selector-dsm69 | |
*/ | |
(function () { |
This file contains 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
''' | |
Given a list of schedules, provide a list of times that are available for a meeting | |
Example input: | |
[ | |
[[4,5],[6,10],[12,14]], | |
[[4,5],[5,9],[13,16]], | |
[[11,14]] | |
] |
This file contains 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 path = require('path'); | |
const child = require('child_process'); | |
const browserSync = require('browser-sync'); | |
const browserify = require('browserify'); | |
const watchify = require('watchify'); | |
const log = require('fancy-log'); | |
const source = require('vinyl-source-stream'); | |
const streamify = require('gulp-streamify'); | |
const gulp = require('gulp'); |
This file contains 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 os, sys | |
import json, re | |
import random | |
import wikipedia | |
from urllib import request | |
from time import sleep | |
import pandas as pd | |
MIN_SET = 31 | |
MAX_SET = 118 |
This file contains 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
''' | |
-> CONTEXT-FREE GRAMMAR <- | |
expr --> expr PLUS term | expr MINUS term | term | |
term --> term TIMES factor | term DIVIDE factor | factor | |
factor --> exponent POW factor | exponent | |
exponent --> MINUS exponent | final | |
final --> DIGIT | ( expr ) | |
''' |