code --list-extensions --show-versions
This file contains hidden or 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
/// Requirement: print the area of the given shape | |
void print_area(const Shape &shape) | |
{ | |
std::cout << shape.get_area() << std::endl; | |
} | |
int main(){ | |
std::vector<std::unique_ptr<Shape>> shapes; | |
shapes.push_back(std::make_unique<Circle>(10)); | |
shapes.push_back(std::make_unique<Circle>(11.0)); |
This file contains hidden or 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
//Your task is as follows (note that class/function names are CaSE-SenSItiVe) | |
#include <string> | |
// 1. Create a class called Vehicle. | |
class Vehicle | |
{ | |
public: | |
virtual const std::string GetType() const = 0; | |
virtual unsigned int GetMaxSpeed(bool isMPH) = 0; |
This file contains hidden or 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, { Component } from 'react'; | |
import { Text, View, StyleSheet, ScrollView, Image, Animated } from 'react-native'; | |
import { Constants } from 'expo'; | |
// You can import from local files | |
import AssetExample from './components/AssetExample'; | |
// or any pure javascript modules available in npm | |
import { Card } from 'react-native-elements'; // 0.18.5 |
This file contains hidden or 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
# Assumes 3 sequential commits: | |
# | |
# 1. commit tagged "prettier-before" that added `prettier` depedency and `prettier` script your package.json | |
# 2. commit that actually ran `prettier` on your entire codebase for the first time | |
# 3. commit tagged "prettier-after" that fixes any minor issues caused by prettier (e.x. moving eslint-ignore or $FlowFixMe comments around), or just the next commit if there were none | |
# | |
# I recommend running these as individual commands, not as a script, in case of merge conflicts | |
# In the sweepbright app this commits have the following hashes | |
# $prettier-before 👉 352f43227d9ae5de0de92b48158d0f02feb7588c | |
# $prettier-after 👉 5330ac90e7adf6f0867228680686f6aaedd8b065 |
This file contains hidden or 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, { Component } from 'react'; | |
import { Text, View, StyleSheet } from 'react-native'; | |
import { Slider } from 'react-native-elements'; | |
import { Constants } from 'expo'; | |
// You can import from local files | |
import AssetExample from './components/AssetExample'; | |
// or any pure javascript modules available in npm | |
import { Card } from 'react-native-elements'; // Version can be specified in package.json |
This file contains hidden or 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
console.log( | |
`%c label %c ...message... %c !!! `, | |
"background-color: #f00; color: #fff; padding: 2px; font-weight: bold;", | |
"background-color: #fcc; padding: 2px;", | |
"background-color: #f00; color: #fff; padding: 2px; font-weight: bold;", | |
); | |
// https://twitter.com/brian_d_vaughn/status/1025045172818563072 |
This file contains hidden or 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
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
N = gets.to_i | |
def reverse(number) | |
result = 0 | |
while number > 0 | |
result = result * 10 + number % 10 | |
number /= 10 | |
end | |
result |
This file contains hidden or 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
def prime?(number, primes) | |
true unless !primes.empty? | |
to_check = primes.select do |x| | |
x*x < number | |
end | |
to_check.any? do |divisor| | |
# puts "#{number}, #{divisor}" | |
(number % divisor).zero? | |
end | |
end |
This file contains hidden or 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, { | |
cloneElement, | |
useState, | |
useEffect, | |
useRef, | |
HTMLAttributes, | |
ReactElement | |
} from "react"; | |
//////////////////////////////////////////////////////////////////////////////// |