Skip to content

Instantly share code, notes, and snippets.

View franklinsales's full-sized avatar
😊
Well...trying to get the things done

Franklin Sales franklinsales

😊
Well...trying to get the things done
View GitHub Profile
@franklinsales
franklinsales / gist:ba968b68254c3e96291c1a86fb6f29ee
Created August 25, 2020 04:04 — forked from solenoid/gist:1372386
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};

Do the following to trigger the gitignore:

Commit all your pending changes in the repository which you want to fix and push that.

Remove everything from the git index in order to refresh your git repository. This is safe. Use this command:

$ git rm -r --cached .

Add everything back into the repo, which can be done using this command:

@franklinsales
franklinsales / go.mod
Created April 22, 2020 01:49
Golang Tip: replace in go.mod
module github.com/acme/foo
go 1.12
require (
github.com/acme/bar v1.0.0
)
replace github.com/acme/bar => /path/to/local/bar
@franklinsales
franklinsales / console-tips.js
Created April 20, 2020 18:56
console.log tips
console.log("This is a console.log")
console.warn("This is a console.warn")
console.error("This is a console.error")
console.debug("this is a debug", {name: "fake object that you want debug"})
console.group("This is a init of console.group")
console.log("This is a item of a console.group in the level 1")
@franklinsales
franklinsales / Instructions.sh
Created November 15, 2018 07:02 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@franklinsales
franklinsales / convert-string-to-time.go
Created August 13, 2017 17:47
Convert string with a time to a golang time type.
package main
import (
"fmt"
"time"
)
func main() {
timeFormat := "15:04:05"
@franklinsales
franklinsales / timeAdd.go
Created April 20, 2017 21:19
Go example using time.Time.Add()
package main
import (
"fmt"
"time"
)
func main() {
datetimeFormat := "2006-01-02 15:04:05"
now := time.Now()
@franklinsales
franklinsales / diff-dates.go
Created April 14, 2017 19:29
Just a test in Go to calculate the diff between dates
package main
import (
"fmt"
"time"
)
func main() {
datetimeFormat := "2006-01-02 15:04:05"
today, _ := time.Parse(datetimeFormat, "2017-04-16 23:00:00")
@franklinsales
franklinsales / datetime.go
Created April 14, 2017 19:11
Just a raw gist where I handle in go a datetime value in mysql format
package main
import (
"fmt"
"time"
)
func main() {
datetimeFormat := "2006-01-02 15:04:05"
timeNow := time.Now().Format(datetimeFormat) // 2009-11-10 23:00:00 (value of Go Playground)
@franklinsales
franklinsales / docker-php-list-extensions.txt
Created January 26, 2017 07:53
Docker php list extensions
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/