Skip to content

Instantly share code, notes, and snippets.

@evandocarmo
evandocarmo / Load Function
Created September 22, 2016 16:00
Load Function
bool load(FILE* file, BYTE** content, size_t* length)
{
*content = NULL;
*length = 0;
BYTE buffer[BYTES];
ssize_t bytes = 1;
while(bytes != 0)
{
bytes = fread(buffer, BYTES, 1, file);
*content = realloc(*content, *length + bytes + 1);
#include <vector>
#include <string>
#include <iostream>
using namespace std;
class Room {
public:
Room() { }
Room(vector<string> input){ map = input; }

CROmetrics Engineering Application

Thanks for your interest in working with us! To apply:

  • Create a "new gist" (link in github header once you're logged in) with the Raw Text of this .md file (do not fork this gist). Please name your gist a crometrics-application.md so that it's formatted correctly (not a .txt file)
  • Answer the following questions in the spaces provided
  • Send an email to tom@crometrics.com, chris@crometrics.com, and matthew.gossage@crometrics.com that includes:
    • A paragraph that tells us a little about yourself and why you are interested in this job
    • A link to your Gist
  • Your desired hourly rate and general availability
@evandocarmo
evandocarmo / Google Geocoding API request
Last active August 10, 2017 22:55
Google Geocoding API request - Node JS
const fs = require('fs');
const request = require('requestify');
let string = fs.readFileSync('update.json','utf-8');
let houses = JSON.parse(string); //array of json objects with properties 'nome','endereco','cidade'
for(let i = 0; i < houses.length; i++){
let house = houses[i];
let url = ' 'https://maps.googleapis.com/maps/api/geocode/json?address='+ encodeURIComponent(house.endereco + ', ' + house.cidade) + '&key=AIzaSyCp46SfQETjxnBDdIFCJTAScsyyShChX5E';
request
@evandocarmo
evandocarmo / carthook-1.js
Last active August 12, 2017 00:38
Carthook Support Engineer Interview
//2. Write a short javascript function that displays the first non repeating character in a string.Example: If the string is "Alphabet", it would print out the letter "l"
function firstUnrepeatedLetter (word){
word = word.toLowerCase();
let hash = {};
for(let char of word){
if(!hash[char])
hash[char] = 1;
else
hash[char] += 1;
}
/*
1. Write a SQL query that returns names and emails of customers whose credit cards are about to get expired (in the next 14 days). Data model looks like this:*
1. Table Customer (id, name, address, email)
2. Table CustomerCreditCards(id,customer_id, ccnumber, cvs, expirationdate)
*/
SELECT name, email FROM Customer
INNER JOIN CustomerCreditCards
ON Customer.id = CustomerCreditCards.customer_id
WHERE DATEDIFF(CustomerCreditCards.expirationdate,NOW()) <= 14;
ANSWER: The intention of the code is to hide block letter b, where the target of the anchor tag is NOT blank. However,
there is a small typo causing a bug. The original code is as follows: **/
$("div a[target!='_blank"]").hide();
The double quotes after blank cose the selector, causing a bug. The correct code would be:
$("div a[target!='_blank']").hide();
Which should work fine.
var closingMap = {
'{': '}',
'[': ']',
'(': ')'
};
function isBalancedBracketSequence(expression) {
var length = expression.length;
if (length <= 1 || length % 2 !== 0) {
return false;
@evandocarmo
evandocarmo / queueWithTwoStacks.js
Last active August 15, 2017 00:50
Implementation of a Queue class using two stacks as a challenge for HackerRank
class Queue {
constructor() {
this.inStack = [];
this.outStack = [];
}
enqueue(element) {
this.inStack.push(element);
}
dequeue() {
if (!this.outStack.length)
/* The goal of this gist is to try and clarify the following code... */
import {
Injectable
} from '@angular/core';
import {
Observable
} from 'rxjs/Observable';
import {
Subject
} from 'rxjs/Subject';