Skip to content

Instantly share code, notes, and snippets.

View einnar82's full-sized avatar
🎯
Doing nice things.

Rannie Ollit einnar82

🎯
Doing nice things.
View GitHub Profile
@einnar82
einnar82 / ExcelRule.php
Created May 13, 2020 01:16
Excel Validation Rule
<?php
namespace App\Rules\API;
use Illuminate\Contracts\Validation\Rule;
class ExcelRule implements Rule
{
/**
* Create a new rule instance.
@einnar82
einnar82 / README.md
Created May 9, 2020 02:39
Elasticsearch Basics
Elasticsearch RDBMS
Document Row
Type Column
Index Index

Cluster - collection of one or more nodes. Node - it has shards and replicas, it is the single instance of Elasticsearch Shard - distributor of data, it allows you to split data across different shards

@einnar82
einnar82 / forms.py
Last active May 4, 2020 07:37
Mass assignment in Django Forms
from django import forms
class RegistrationForm(forms.Form):
username = forms.CharField(max_length=100)
password = forms.CharField(max_length=100)
email = forms.CharField(max_length=100)
phone = forms.CharField(max_length=100)
@einnar82
einnar82 / .gitlab-ci.yml
Created April 14, 2020 03:29
Vue.js CI CD Yaml Template
# prerequisites: must install scp or rsync for both machines
stages:
- build
- deploy
# build stage
build_app:
image: node:alpine
stage: build
only:
@einnar82
einnar82 / django_crash_course.MD
Created April 9, 2020 03:25 — forked from bradtraversy/django_crash_course.MD
Commands for Django 2.x Crash Course

Django Crash Course Commands

# Install pipenv
pip install pipenv
# Create Venv
pipenv shell
@einnar82
einnar82 / laravel-echo-server.json
Created March 27, 2020 10:03
Laravel Echo Server Config
{
"authHost": "http://localhost",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis" : {
"port": "6379",
"host": "localhost"
},
@einnar82
einnar82 / vue.config.js
Created March 26, 2020 07:36
Vue cache busting
module.exports = {
"transpileDependencies": [
"vuetify"
],
chainWebpack: config => {
config.plugin('html').tap(args => {
args[0].hash = true
return args
})
}
@einnar82
einnar82 / Kernel.php
Created February 12, 2020 01:31
Best Practice when using Laravel Schedule
<?php
namespace App\Console;
use App\Console\Commands\SendRemcoDTRCommand;
use App\Modules\USP\Jobs\Remco\RemcoDTRJob;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
@einnar82
einnar82 / samplewebsite.com
Created January 30, 2020 05:07
Nginx cors config
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
@einnar82
einnar82 / MountainBike.java
Created January 28, 2020 06:59
Superclass vs Subclass part 2
public class MountainBike extends Bicycle {
// Now, the Bicycle class is the SUPERCLASS and the MountainBike class is the SUBCLASS
// the MountainBike subclass adds one field
public int seatHeight;
// the MountainBike subclass has one constructor
public MountainBike(int startHeight,
int startCadence,
int startSpeed,
int startGear) {