Skip to content

Instantly share code, notes, and snippets.

View websterl3o's full-sized avatar

Leonardo Webster. R. Silva websterl3o

View GitHub Profile
@bomsn
bomsn / geolocation.js
Last active March 11, 2024 16:22
Get User Postal Code ( Zip Code ) with Browser Geolocation & Google API
// jQuery must be loaded before calling this function ( for AJAX )
let getUserPostcode = () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
let lat = position.coords.latitude,
long = position.coords.longitude,
url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + lat + "," + long + "&key=YOUR_GOOGLE_API_KEY";
$.ajax({
type: "GET",
Note: this assumes you are using ZSH shell.
## Installation
Install [asdf](https://github.com/asdf-vm/asdf):
```
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.4.0
$ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
$ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
@mrtuvn
mrtuvn / auth.json.sample
Created April 19, 2019 02:05
auth.json.sample
{
"github-oauth": {
"github.com": "TOKEN"
},
"http-basic": {
"packages.vnecoms.com": {
"username": "key",
"password": "pass"
},
"repo.magento.com": {
@Tamal
Tamal / git-ssh-error-fix.sh
Last active May 8, 2024 15:47
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
Note: this assumes you are using ZSH shell.
## Installation
Install [asdf](https://github.com/asdf-vm/asdf):
```
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.4.0
$ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
$ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
@yidas
yidas / composer-install-vcs.md
Last active April 23, 2024 04:45
Composer install package via VCS such as GitLab (Private package requirement)

Composer install package via VCS such as GitLab

(Private package requirement)

1. Create composer.json:

{
    "repositories": [                                             
        {                                                         
 "type": "vcs", 
@chuckrincon
chuckrincon / ConfigServiceProvider.php
Last active October 10, 2023 14:13
Load all your lumen config files painless.
<?php
namespace App\Providers;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
class ConfigServiceProvider extends ServiceProvider
{
@Razoxane
Razoxane / laravel_conditional_index_migration.php
Created August 8, 2017 01:35
Laravel - Create Index If Not Exists / Drop Index If Exists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class LaravelConditionalIndexMigration extends Migration
{
/**
* Run the migrations.
@jherax
jherax / is-private-mode.js
Last active March 19, 2024 18:29
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*
@subfuzion
subfuzion / global-gitignore.md
Last active May 5, 2024 19:34
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.