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
#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); | |
} |
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
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) |
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
# 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''' |
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
# 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''' |
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
from fractions import Fraction as f | |
import math | |
def decompose(n): | |
frac = f(n) | |
out = [] | |
current_denom = 1 | |
if frac >= 1: | |
number = int(frac) |
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 strict"; | |
let n = 5; //number of images, i.e. sides of the carousel | |
let panel_width = window.innerWidth * .4167; //width of a panel, i.e. length of a side on the polygon | |
let ratio_mismatch = false; | |
if(Math.abs((window.innerWidth / window.innerHeight) - (1920 / 1012)) > .20) { | |
// if the aspect ratio of the viewport and the video is off, since you can't change the aspect ratio of | |
// the video on the fly, the video sometimes will not completely cover the image it's laid on top of. | |
// In this case, we'll hide the image when the user hovers over the image. | |
ratio_mismatch = true; | |
$('.carousel_image').css("transition", "opacity 0.5s ease-out"); |
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 React from 'react'; | |
import { shallow } from 'enzyme'; | |
class TestComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
description: 'asdf123' | |
}; |
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 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(); | |
}); |
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
{ | |
"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", |
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
// 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) => { |
OlderNewer