Skip to content

Instantly share code, notes, and snippets.

Thiago Mata thiagomata

Block or report user

Report or block thiagomata

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thiagomata
thiagomata / test.js
Created Apr 23, 2019
Playing around creating combinations from number based on dic
View test.js
const exec = require('child_process').exec;
var letters = " abcdefghijklmnopqrstuvxz".split("");
var args = process.argv.slice(2);
function number_to_word(number) {
let result = "";
while (number > 0 ) {
let pos = number % letters.length;
let char = letters[ pos ];
@thiagomata
thiagomata / TidyPrint.Rmd
Last active Feb 3, 2019
Printing Properly the Output of Functions on R Markdown
View TidyPrint.Rmd
# What is this?
Many R functions have a nice printable version that is accessible throw the print function.
But, when we want to get this content and using it to print inside of the HTML or PDF document, the result is not good.
This function helps to get the printable content into a varible.
## The Function
```{r tidy_print_function}
library(stringr)
@thiagomata
thiagomata / sed-replace-accents-chars.sh
Last active Jun 28, 2016
Replace Accents Characters to Ascii in Regex Variable using Sed.
View sed-replace-accents-chars.sh
echo '{"doNotReplaceKey":"bábögêjírù","replaceValueKey":"bábögêjírù"}' \
| sed -e ':a;s/replaceValueKey":"\(.*\)[áâàãä]/replaceValueKey":"\1a/g;ta' \
| sed -e ':a;s/replaceValueKey":"\(.*\)[éêèë]/replaceValueKey":"\1e/g;ta' \
| sed -e ':a;s/replaceValueKey":"\(.*\)[íîìï]/replaceValueKey":"\1i/g;ta' \
| sed -e ':a;s/replaceValueKey":"\(.*\)[óôòõö]/replaceValueKey":"\1o/g;ta' \
| sed -e ':a;s/replaceValueKey":"\(.*\)[úûùü]/replaceValueKey":"\1u/g;ta'
# result:
# {"doNotReplaceKey":"bábögêjírù","replaceValueKey":"babogejiru"}
View postgresql_grid.sql
/*
-- EXAMPLE --
SELECT
* FROM
unnest(grid(array(SELECT
(
lat,
View postgresql_kmeans.sql
/**
* Based on the mysql cluster
* @link http://jonisalonen.com/2012/k-means-clustering-in-mysql/
*/
-- SELECT
-- * FROM
-- unnest(kmeans(array(SELECT
-- (
-- lat,
View ValidateModelTrait
<?php
namespace App\Models\Traits;
use \Validator;
trait ValidateModelTrait
{
private $errors;
private $objValidator;
@thiagomata
thiagomata / file-tree.txt
Last active Aug 29, 2015
A workaround to be able to create the maps files into a separate file of the javascript files from the coffescript files what are into a tree structure.
View file-tree.txt
project
src
coffee
foo.coffee
component
bar.coffee
animals
dog.coffee
cat.coffee
public
You can’t perform that action at this time.