Skip to content

Instantly share code, notes, and snippets.

<?php
$capsule = new Capsule; // when used standalone, or Illuminate\Database\Capsule\Manager when used directly from the framework
$capsule->addConnection([
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'illuminate_non_laravel',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
<?php
require 'autoload.php'; // they're setting cwd to root
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Controllers\Bootstrap;
$app = new Bootstrap('');
@nmeri17
nmeri17 / Doctrine-auth.php
Created September 24, 2021 12:59
Retrieving user in doctrine suphple integration
->createQueryBuilder()
->select('u')->from(User::class, 'u')
->where('u.email = ?1')->setParameter(1, pull email from payloadStorage])
var FormActivity = (() => {
/*
*
* @description: Defines interaction with admin panel components, back and forth the server and conversion of the resonse into pretty fields
*
* @param: {statusContainer} Selector where the status of next activity will be displayed
* @param: {toRemove} fields in the returned data to not create inputs for
* @param: {addMore} will place a button beside these inputs to append more
* @param: {folderRoot} set to remote url if your back end lives on another domain
*
dashboard
- summary statistical charts
- transaction tables
- abandoned orders table
- product review section
user management
- vendors page
- buyer page
@nmeri17
nmeri17 / notificationWidget.dart
Created April 20, 2021 11:11
contains widget and a few snippets related to sending and receiving firebase notifications
import 'dart:async';
import 'dart:convert';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
@nmeri17
nmeri17 / add-to-sales-functionality.js
Last active November 5, 2020 13:08
An attempt to replicate reactive functionality entirely with jQuery
<script>
var promoInfos = {
promo: 'Product will be added to Promo page',
store: 'Discount must be above 30%'
},
promoFieldAdded = false,
temp = $('.sales-type-template.original'),
@nmeri17
nmeri17 / webpack.mix.js
Created October 5, 2020 19:25
Webpack implementing code splitting to a custom location other than public
var mix = require('laravel-mix')/*,
WorkboxWebpackPlugin = require("workbox-webpack-plugin")*/;
var path = require("path")
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
@nmeri17
nmeri17 / activity-products.php
Last active June 23, 2020 14:39
fetch insightful products based on user activity
<?php
class Activity {
public function trending (int $totalCount, string $paginationName) {
$ratioPaginate = function($builder, $ratio) use ($totalCount, $paginationName) {
return $builder->paginate(round(($ratio/5)*$totalCount), ['*'], $paginationName);
};
@nmeri17
nmeri17 / desktop-click-to-lazy-load.js
Last active August 7, 2020 15:20
Lazy and infinite scrollers for desktop and mobile
export default {
props : ['products', 'load_more_link', 'lazy_load', 'fetch_name'],
components: {DefaultCard},
data() {
return {
loading: false, nextPageUrl: this.load_more_link,