Skip to content

Instantly share code, notes, and snippets.

View MikeShi42's full-sized avatar
💭
🚀

Mike Shi MikeShi42

💭
🚀
View GitHub Profile
@MikeShi42
MikeShi42 / test.sh
Created January 28, 2016 20:38
CSE100 PA2 Bash Tester
#!/bin/sh
# WARNING: It'll DELETE files called "compressed" "decompressed" "ref_compressed" if that's important
# This tests all files in input_files directory. Place in pa2 project root folder.
# It's pretty janky, it will output the diff if there's something wrong
# It'll discard all output by compress, uncompress, and ref_compress
# It also prints out the file sizes so you can check your file size against ref compress
# Code is pretty straight foward, should def read before using. Use at your own risk.
@MikeShi42
MikeShi42 / SlideTextInput.js
Created October 19, 2016 20:36
Terrible TextInput extends that doesn't steal all touches.
import React, { Component } from 'react';
import {TextInput, TouchableWithoutFeedback, StyleSheet} from 'react-native';
const Platform = require('Platform');
const requireNativeComponent = require('requireNativeComponent');
const emptyFunction = require('fbjs/lib/emptyFunction');
if (Platform.OS === 'android') {
var AndroidTextInput = requireNativeComponent('AndroidTextInput', null);
} else if (Platform.OS === 'ios') {
var RCTTextView = requireNativeComponent('RCTTextView', null);
@MikeShi42
MikeShi42 / xss.ipynb
Last active January 18, 2018 19:26
xss ipynb test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MikeShi42
MikeShi42 / classes.txt
Created June 8, 2018 06:17
ModelDepot Percept Class Names
Isle of man tt
Amusement park
Roller coaster
Granny smith
Air show
Reflex camera
Membranophone
String instrument
Wind instrument
Gourd
@MikeShi42
MikeShi42 / index.js
Created August 9, 2018 08:54
competitive-2048 index.js
const express = require('express');
const socketio = require('socket.io');
const http = require('http');
const app = express();
const server = http.Server(app);
const io = socketio(server); // Attach socket.io to our server
app.use(express.static('public')); // Serve our static assets from /public
@MikeShi42
MikeShi42 / index.html
Created August 10, 2018 18:38
Part of Index.html for competitive 2048
<div id="player-one">
<div class="game-container">
<div class="game-message">
<p></p>
<div class="lower">
<a class="keep-playing-button">Keep going</a>
<a class="retry-button">Try again</a>
</div>
</div>
<div class="grid-container">
@MikeShi42
MikeShi42 / index-pt2.js
Created August 13, 2018 17:17
competitive 2048 index js pt 2
const connections = [null, null];
// Handle a socket connection request from web client
io.on('connection', function (socket) {
// Find an available player number
let playerIndex = -1;
for (var i in connections) {
if (connections[i] === null) {
playerIndex = i;
socket.on('actuate', function (data) {
const { grid, metadata } = data; // Get grid and metadata properties from client
const move = {
playerIndex,
grid,
metadata,
};
// Emit the move to all other clients
socket.on('actuate', function (data) {
const { grid, metadata } = data; // Get grid and metadata properties from client
const move = {
playerIndex,
grid,
metadata,
};
// Emit the move to all other clients
socket.on('actuate', function (data) {
const { grid, metadata } = data; // Get grid and metadata properties from client
const move = {
playerIndex,
grid,
metadata,
};
// Emit the move to all other clients