Skip to content

Instantly share code, notes, and snippets.

@tioback
tioback / server.js
Created July 16, 2020 18:58
server.js for Pager interview
// author Renato Back (renatopb@gmail.com)
const Hapi = require('hapi');
const MongoClient = require('mongodb').MongoClient;
const server = Hapi.server({
port: 3000,
debug: {
request: ['*']
}
@tioback
tioback / application-logger.decorator.ts
Created January 21, 2019 16:52
App Logger usando funções anônimas ao invés de arrow functions
import * as _ from 'lodash';
import { FunctionLoggerOptions } from './interfaces';
import { defaultFunctionOptions } from './default-options';
import { logMessage } from './messages.helper';
export const logger = function (options = defaultFunctionOptions): Function {
return function(target: any, methodName: string, descriptor: any) {
if (descriptor === undefined) {
descriptor = Object.getOwnPropertyDescriptor(target, methodName);
@tioback
tioback / PKZIP APPNOTE 6.3.4.
Created February 11, 2018 13:17 — forked from ross-spencer/PKZIP APPNOTE 6.3.4.
Unmodified copy of PKZIP Speciffication, source date: 1 November 2015: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
File: APPNOTE.TXT - .ZIP File Format Specification
Version: 6.3.4
Status: Final - replaces version 6.3.3
Revised: October 1, 2014
Copyright (c) 1989 - 2014 PKWARE Inc., All Rights Reserved.
1.0 Introduction
---------------
1.1 Purpose
@tioback
tioback / DeckCounter.java
Created August 30, 2017 13:24
Full Deck Counter
package performer.oss.usecases.oss_014;
import java.util.*;
/**
* 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, A
The four suits are:
S - Spade (♠), C - Club(♣), H - Heart(♥), D - Diamond(♦)
@tioback
tioback / object-watch.js
Created June 23, 2017 20:06 — forked from eligrey/object-watch.js
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@tioback
tioback / object-watch.js
Created June 23, 2017 20:06 — forked from eligrey/object-watch.js
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Pattern;
// https://www.hackerrank.com/challenges/a-very-special-multiple
public class AVerySpecialMultiple {
private static Pattern PATTERN = Pattern.compile("^(4+)(0*)$");
@tioback
tioback / idea-reset-evaluation.sh
Created April 18, 2017 17:27
reset intellij idea 14 evaluation
#!/bin/bash
echo "removeing evaluation key"
rm ~/.IntelliJIdea15/config/eval/idea15.evaluation.key
echo "resetting evalsprt in options.xml"
sed -i '/evlsprt/d' ~/.IntelliJIdea15/config/options/options.xml
echo "resetting evalsprt in prefs.xml"
sed -i '/evlsprt/d' ~/.java/.userPrefs/prefs.xml
@tioback
tioback / Input with suggestions
Created September 26, 2016 19:42
Workaround for using zIndex with Android.
import React, {Component} from "react";
import {
Dimensions,
Image,
Keyboard,
Modal,
Platform,
ScrollView,
StyleSheet,
Text,