Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Illuminate\Auth;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;
class GenericUser implements UserContract
{
/**
* All of the user's attributes.
/* getting errors like:
[ignore]map_0_830091793909.setOptions, because it's not ready
Uncaught (in promise): TypeError: Cannot read property 'position' of undefined
*/
ionViewDidLoad() {
console.log('ionViewDidLoad AnyNamePage');
}
export class AnyNamePage {
map: GoogleMap;
constructor(public navCtrl: NavController, public navParams: NavParams, private socialSharing: SocialSharing ) {}
ionViewWillLeave() {
// not checking for auctions made in previous months. auctions here are dated annually
var mainRes = [],
limit = 3; // for debug
// get all auctions. auctions contain specific sales that occurred
$('.grid_cell_auction')/*.slice(0, limit)*/.each(function(i,el) {
@nmeri17
nmeri17 / implement eloquent on new kglo db structure.php
Last active June 26, 2019 09:49
Decrease database queries and memory footprint by improving model relationships
<?php
// message model
public function adverts()
{
return $this->morphedByMany();
}
public function reports()
@nmeri17
nmeri17 / countdown.js
Last active November 8, 2019 14:37
Countdown how much time between a specified date and this moment, descending
function setTimes () {
var todayObj = new Date(), deadline = new Date('2019-11-11'), // '2019-11-08 14:59:00'
todaySecond = todayObj.getSeconds(), todayMinute = todayObj.getMinutes(),
todayHour = todayObj.getHours(), todayDay = todayObj.getDate(),
deadlineSecond = deadline.getSeconds(), deadlineMinute = deadline.getMinutes(),
@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,
@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 / 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 / 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'),