Skip to content

Instantly share code, notes, and snippets.

Leonardo Antunes antunesleo

Block or report user

Report or block antunesleo

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
View gist:1e130ef23f57667a1dd37a677c382bba
location /cache {
add_header Access-Control-Allow-Origin *;
alias /some-folder/some-another-folder;
}
View checking-if-the-user-are-online.js
window.addEventListener('load', function(e) {
if (navigator.onLine) {
console.log('We\'re online!');
} else {
console.log('We\'re offline...');
}
}, false);
window.addEventListener('online', function(e) {
console.log('And we\'re back :).');
View coaching-marcinho.spec.js
describe('SignupController', function() {
beforeEach(module('manotes.controllers'));
var $scope, $controller, $rootScope, $httpBackend, Account;
beforeEach(inject(function(_$controller_, _$rootScope_, _$httpBackend_){
$httpBackend = _$httpBackend_;
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
Account = jasmine.createSpy('Account');
$controller = _$controller_('SignupController', {
View config-machine-digital-ocean
# Machine setup: postgres11, nodejs 4.2.6, python 3.7
$ adduser leonardo
$ usermod -aG sudo leonardo
$ su - leonardo
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ vim ~/.ssh/authorized_keys
$ chmod 600 ~/.ssh/authorized_keys
$ exit
@antunesleo
antunesleo / Python3, Pip3, Virtualenv and Virtualenvwrapper Setup Setting up and using Python3, Pip3, Virtualenv (for Python3) and Virtualenvwrapper (for Python3)
View Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py
$ cd <download location>
$ sudo -H python ./get-pip.py
Installing pip also installs Python3
To run Python3
$ python3
Install pip3 by just executing the same file as in the step above, but this time using Python3
$ sudo -H python3 ./get-pip.py
View geoquery-user-location-polygon-response.json
{
"took": 100,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
View geoquery-user-location-polygon.json
GET user_location/_search
{
"query": {
"bool" : {
"filter" : {
"geo_polygon" : {
"location" : {
"points" : [
"-25.44373,-49.24248",
"-25.44297,-49.24230",
View geoquery-user-location-radius-600m-response.json
{
"took": 23,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
View geoquery-user-location-radius-600m.json
GET user_location/_search
{
"query": {
"bool" : {
"filter" : {
"geo_distance" : {
"distance" : "600m",
"location" : "-25.442987, -49.239504"
}
}
View geoquery-user-location-radius-300m-response.json
{
"took": 12,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
You can’t perform that action at this time.