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

code --list-extensions --show-versions

//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;
/// 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));
@krvajal
krvajal / index.html
Last active January 4, 2018 23:44 — forked from anonymous/index.html
Redux store implementation
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://fb.me/react-15.1.0.js"></script>
#include <string>
#include <cstdio>
#include <iostream>
#include <map>
#include <vector>
#include <boost/algorithm/string.hpp>
#include <array>
using namespace std;
using namespace boost;
import os
def get_filepaths(directory):
"""
This function will generate the file names in a directory
tree by walking the tree either top-down or bottom-up. For each
directory in the tree rooted at directory top (including top itself),
it yields a 3-tuple (dirpath, dirnames, filenames).
"""
file_paths = [] # List which will store all of the full filepaths.
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# My API
# GET https://api.invertironline.com/api/micuenta/estadocuenta
/*
problema de la entrevista que mencioné en el último podcast:
https://soundcloud.com/sin-humo/entrevistas-de-trabajo-y-111mil
la idea es crear la función 'deferred', que permita un comportamiento
similar a lo que serían promises de javascript.
el deferred puede 'resolverse' con un valor cualquiera, o con otro 'deferred'.
en el segundo caso, el próximo `then` debería "esperar" también a este.
#!python
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
r"""Smooth (and optionally differentiate) data with a Savitzky-Golay filter.
The Savitzky-Golay filter removes high frequency noise from data.
It has the advantage of preserving the original shape and
features of the signal better than other types of filtering
approaches, such as moving averages techniques.
Parameters
----------
y : array_like, shape (N,)
@krvajal
krvajal / error.js
Created June 4, 2016 23:37
Report js errors to google analytics
window.onerror = (msg, file, line, column, error=null)=>{
try{
if(error){ // error param not supported everywhere
msg = error.stack;
}
ga('send','event','error', `${file}:{line}`, msg)
}catch(e){
// no-op