Skip to content

Instantly share code, notes, and snippets.

View krvajal's full-sized avatar
:electron:
What's happening?

Miguel Carvajal krvajal

:electron:
What's happening?
  • @wearesinch
  • Antwerpen, Belgium
View GitHub Profile
/// 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));
//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;

code --list-extensions --show-versions

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
@krvajal
krvajal / prettier-branch.sh
Last active June 25, 2018 14:25 — forked from tlrobinson/prettier-branch.sh
Steps for merging an old branch into a newly prettier-ified codebase. Use at your own risk, verify everything was correctly merged.
# 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
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
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
# 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
@krvajal
krvajal / aa.rb
Last active November 7, 2018 07:03
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
import React, {
cloneElement,
useState,
useEffect,
useRef,
HTMLAttributes,
ReactElement
} from "react";
////////////////////////////////////////////////////////////////////////////////