Skip to content

Instantly share code, notes, and snippets.

View antunesleo's full-sized avatar

Leonardo Antunes antunesleo

View GitHub Profile
@antunesleo
antunesleo / filter-ol.js
Created April 10, 2018 00:19
canvas filter ol
var app = angular.module("showGeometry", []);
app.config([function() {
}]);
app.run(function($rootScope) {
});
app.controller("mapController", ['$scope', function($scope) {
alias load-env='export $(cat .env | xargs)'
alias load-env-test='export $(cat .env.test | xargs)'
[
'{{repeat(10)}}',
{
active: '{{bool()}}',
company: '{{company().toUpperCase()}}',
email: '{{email()}}',
address: '{{street()}}, {{integer(100, 999)}} - {{city()}} - {{state()}}, {{integer(10000, 19000)}}-{{integer(100, 999)}}',
latitude: '{{floating(-22.000001, -23)}}',
longitude: '{{floating(-47.000001, -48)}}',
tags: [
@antunesleo
antunesleo / GetLocationRecursive.js
Created August 15, 2018 01:35
Getting location from device after 2 seconds.
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { Button } from 'react-native';
class GeolocationExample extends Component {
constructor(props) {
super(props);
this.state = {
@antunesleo
antunesleo / files_dirs
Created August 23, 2018 19:37
Not tested
import os
import shutil
from distutils import dir_util
class DirAlreadyExists(Exception):
pass
class FileAlreadyExists(Exception):
pass
@antunesleo
antunesleo / Mapping Movies
Last active September 4, 2018 00:23
mapping index movies in elasticsearch
PUT movies
{
"mappings": {
"_doc": {
"properties": {
"title" : { "type" : "text" },
"year": {"type" : "integer"},
"director": {"type": "text"},
"stars": {"type": "text"}
}
@antunesleo
antunesleo / Mapping Fields
Created September 4, 2018 00:37
Syntax to map the field of an index
{
"mappings": {
"_doc": {
"properties": {
# all my fields here
}
}
}
}
@antunesleo
antunesleo / put-movies.json
Last active October 5, 2018 12:01
Mapping genres field in existing movies index
PUT movies/_mapping/_doc
{
"properties": {
"genres": {
"type": "text"
}
}
}
@antunesleo
antunesleo / put-movies-genres.json
Last active October 5, 2018 12:10
Trying to create a new field genres in existing field movies
PUT movies
{
"mappings": {
"_doc": {
"properties": {
"genres" : { "type" : "text"}
}
}
}
}
@antunesleo
antunesleo / resource-already-exists.json
Created October 5, 2018 12:11
Error trying to create index: resource already exists
{
"error": {
"root_cause": [
{
"type": "resource_already_exists_exception",
"reason": "index [movies/rVw9qS4eS5iTOf5Zc2soZA] already exists",
"index_uuid": "rVw9qS4eS5iTOf5Zc2soZA",
"index": "movies"
}
],