Skip to content

Instantly share code, notes, and snippets.

View apsicle's full-sized avatar
💭
chillin

Ryan Yan apsicle

💭
chillin
  • Gamechanger
  • New York, New York
View GitHub Profile
#include "Light.hpp"
#include <cmath>
void Light::set (double x, double y, double z) {
this -> loc.set(x, y, z);
}
Light::Light(void) {
set(5, 10, 0);
}
if __name__ == "__main__":
for num in range(1,101):
out_str = ""
if(num % 3 == 0):
out_str += "Crackle"
if(num % 5 == 0):
out_str += "Pop"
if(not out_str):
out_str += str(num)
print(out_str)
# Written by: Ryan Yan
# Paired with Oskar Thoren
# Date: October 11th, 2016
#
# This program lets you play tic tac toe in the console using keyboard input against a computer.
import random
class Player:
'''Player objects keep track of the spaces they control on the grid (add_square and get_squares)
and has their symbol, default X's and O's as their string representation'''
from fractions import Fraction as f
import math
def decompose(n):
frac = f(n)
out = []
current_denom = 1
if frac >= 1:
number = int(frac)
# Written by: Ryan Yan
# Date: October 10th, 2016
#
# This program lets two players play tic tac toe in the console using keyboard input.
class Player:
'''Player objects keep track of the spaces they control on the grid (add_square and get_squares)
and has their symbol, default X's and O's as their string representation'''
import React from 'react';
import { shallow } from 'enzyme';
class TestComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
description: 'asdf123'
};
import React from 'react';
import { shallow } from 'enzyme';
import ExpenseForm from '../../components/ExpenseForm.js';
import expenses from '../fixtures/expenses';
test('should render ExpenseForm correctly', () => {
const wrapper = shallow(<ExpenseForm />);
expect(wrapper).toMatchSnapshot();
});
{
"name": "react_redux",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"serve": "live-server public/",
"build": "webpack",
"build-babel": "babel src/app.js --out-file=public/scripts/app.js --presets=env,react --watch",
"dev-server": "webpack-dev-server",
@apsicle
apsicle / backupthreads.js
Created November 14, 2017 04:18
codefights problem I may come back to.
// if you have backup time k for each of n jobs, and each job in parallel goes n times slow (k * n), the completion time for the whole batch is always k * n with or without parallelization.
function backupTimeEstimator(startTimes, backupDuration, maxThreads) {
// Null case
if (startTimes.length === 0) {
return [];
}
// Set up jobs queue, ending time array, jobs running array, and current time.
let jobsQueue = startTimes.map((time, index) => {