Skip to content

Instantly share code, notes, and snippets.

View neoreids's full-sized avatar
🏠
Working from home

Muhammad Nur Wahid neoreids

🏠
Working from home
View GitHub Profile
@neoreids
neoreids / compat_l5.php
Created May 20, 2018 17:15 — forked from vluzrmos/compat_l5.php
Lumen L5 compatibility helpers. That file should be added on root path of your project... and added to your composer.json
<?php
if(!function_exists('config_path'))
{
/**
* Return the path to config files
* @param null $path
* @return string
*/
function config_path($path=null)
@neoreids
neoreids / Pagination.vue
Created June 26, 2018 10:02
Vue Pagination Component with limit Page Number
<template>
<ul class="pagination" v-if="objectPage.last_page > 1">
<li :class="{ disabled: ! prev }" v-on:click="go(prev)"><span>&laquo;</span></li>
<li v-for="(link,k) in links" track-by="$index" :class="{ active: objectPage.current_page == link, disabled: isNaN(link) }" v-on:click="go(link)" v-bind:key="k"><span>{{ link }}</span></li>
<li :class="{ disabled: ! next }" v-on:click="go(next)"><span>&raquo;</span></li>
</ul>
</template>
<script>
export default {
name:"pagination",
@neoreids
neoreids / LICENCE SUBLIME TEXT
Created August 17, 2018 14:06
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
<?php
namespace App\Http\Middleware;
use Closure;
class CorsMiddleware{
/**
* Handle an incoming request.
*
@neoreids
neoreids / ordered_parallel.go
Created April 4, 2019 10:13 — forked from marianogappa/ordered_parallel.go
Parallel processing with ordered output in Go
/*
Parallel processing with ordered output in Go
(you can use this pattern by importing https://github.com/MarianoGappa/parseq)
This example implementation is useful when the following 3 conditions are true:
1) the rate of input is higher than the rate of output on the system (i.e. it queues up)
2) the processing of input can be parallelised, and overall throughput increases by doing so
3) the order of output of the system needs to respect order of input
- if 1 is false, KISS!
@neoreids
neoreids / .bashrc
Created August 17, 2019 12:42 — forked from vsouza/.bashrc
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@neoreids
neoreids / keys.go
Created September 26, 2019 17:17 — forked from sdorra/keys.go
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@neoreids
neoreids / http-proxy.go
Created September 30, 2019 07:40 — forked from fabrizioc1/http-proxy.go
Http proxy server in Go
package main
import (
"fmt"
"io"
"log"
"net/http"
)
type HttpConnection struct {
@neoreids
neoreids / Readme.md
Created April 3, 2020 12:59 — forked from leopoldodonnell/Readme.md
Install and run Postgres with an extension using docker-compose

Local Postgres

This gist is an example of how you can simply install and run and extended Postgres using docker-compose. It assumes that you have docker and docker-compose installed and running on your workstation.

Install

  • Requires docker and docker-compose
  • Clone via http: git clone https://gist.github.com/b0b7e06943bd389560184d948bdc2d5b.git
  • Make load-extensions.sh executable
  • Build the image: docker-compose build
@neoreids
neoreids / validators.py
Created April 14, 2020 09:55 — forked from jrosebr1/validators.py
Validator for files, checking the size, extension and mimetype for Django.
# @brief
# Performs file upload validation for django. The original version implemented
# by dokterbob had some problems with determining the correct mimetype and
# determining the size of the file uploaded (at least within my Django application
# that is).
# @author dokterbob
# @author jrosebr1
import mimetypes