Skip to content

Instantly share code, notes, and snippets.

View bokuweb's full-sized avatar
👾
Working from home

bokuweb bokuweb

👾
Working from home
View GitHub Profile
import * as cdk from '@aws-cdk/core';
import * as backup from '@aws-cdk/aws-backup';
import * as iam from '@aws-cdk/aws-iam';
import { tables } from './tables';
export class BackupStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const puppeteer = require('puppeteer');
const path = require('path');
const util = require('util');
const mkdirp = require('mkdirp');
const initMocha = require('./setup');
const DEVICE_PROFILE = {
viewport: {
width: 1280,
height: 400,
function peco-select-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(\history -n 1 | \
eval $tac | \
peco --query "$LBUFFER")
<ContentEditable
onPaste={(e: React.ClipboardEvent<HTMLDivElement>) => {
// Disable default behavior to prevent html tag pasted.
e.preventDefault();
let pastedText = "";
// clipboard data on paste event (Cross browser)
// See, also https://stackoverflow.com/questions/2176861/javascript-get-clipboard-data-on-paste-event-cross-browser
if (window.clipboardData && window.clipboardData.getData) {
pastedText = window.clipboardData.getData("Text");
} else if (e.clipboardData && e.clipboardData.getData) {
function addActionsType(fileName, { pascalName, importPath }) {
const actionName = `${pascalName}Actions`;
const content = fs.readFileSync(fileName, "utf-8");
const importPathLiteral = t.stringLiteral(`${importPath}`);
importPathLiteral.raw = importPath;
const targetIdentifier = t.identifier(actionName);
const newImportDeclaration = t.importDeclaration(
[t.importSpecifier(targetIdentifier, targetIdentifier)],
importPathLiteral,
);
import pulse from './pulse.js';
export default class Oscillator {
constructor(type) {
try {
const AudioContext = window.AudioContext || window.webkitAudioContext
this.context = new AudioContext();
} catch (e) {
throw new Error('Web Audio isn\'t supported in this browser!');
mergeInto(LibraryManager.library, {
start_oscillator: function (index) {
Module.NES.oscs[index].start();
},
stop_oscillator: function (index) {
Module.NES.oscs[index].stop();
},
close_oscillator: function (index) {
Module.NES.oscs[index].close();
},
const convertKeyCode = (keyCode) => {
switch (keyCode) {
case 88: return 0x01; // X A
case 90: return 0x02; // Z B
case 65: return 0x04; // A SELECT
case 83: return 0x08; // S START
case 38: return 0x10; // ↑ ↑
case 40: return 0x20; // ↓ ↓
case 37: return 0x40; // ← ←
case 39: return 0x80; // → →
#[macro_use]
extern crate lazy_static;
extern crate libc;
mod nes;
mod externs;
use nes::Context;
fn main() {}
use std::cell::RefCell;
use std::ptr::null_mut;
use std::os::raw::{c_int, c_void};
#[allow(non_camel_case_types)]
type em_callback_func = unsafe extern "C" fn();
thread_local!(static MAIN_LOOP_CALLBACK: RefCell<*mut c_void> = RefCell::new(null_mut()));
extern "C" {