Skip to content

Instantly share code, notes, and snippets.

@wtoalabi
wtoalabi / ClientsRevised.vue
Last active January 30, 2018 17:45
Laravel 5.4 OAuth2 token and client components ported to Vue.js 2 and Bulma with Axios
<style scoped>
.action-link {
cursor: pointer;
}
.m-b-none {
margin-bottom: 0;
}
</style>
@wtoalabi
wtoalabi / Isolates
Created March 8, 2019 08:43
Spawning Isolates in Dart
import 'dart:io';
import 'dart:async';
import 'dart:isolate';
Isolate isolate;
main() async{
stdout.writeln('spawning isolate...');
await start();
stdout.writeln('press enter key to quit...');
await stdin.first;
@wtoalabi
wtoalabi / gist:b466f5ed3cf37d1c913935a1d96878ad
Created March 8, 2019 08:45
Updating a map in an array (Dart)
main() {
List<User> users = [
User(lastName: "Mesut", firstName: "Ozil"),
User(lastName: "Becham", firstName: "David"),
User(lastName: "Samir", firstName: "Nasri"),
User(lastName: "Arteta", firstName: "Mikel"),
];
User userOLD = users.firstWhere((user){
return user.firstName == "Mikel";
});
@wtoalabi
wtoalabi / factory_constructor.txt
Last active March 13, 2019 14:09
Factory Constructor in my understanding
//The user factory constructor, when called will return the same instance, no matter how many times. Hence, the name singleton.
main(){
var user1 = User();
user1.name = "Mike";
user1.age = 3;
var user2 = User();
print([user1, user2]);
}
class _BiblePageState extends State<BiblePage> {
final scrollDirection = Axis.vertical;
AutoScrollController controller;
@override
void initState() {
super.initState();
controller = AutoScrollController(
viewportBoundaryGetter: () => Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),
axis: scrollDirection
<?php
namespace App\Providers;
use App\CacheDirective;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class CustomCacheServiceProvider extends ServiceProvider
<?php
namespace App;
use Exception;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Cache\Repository as Cache;
class CacheDirective
{
private static $keys = [];
@wtoalabi
wtoalabi / Webpack.mix.js
Created December 19, 2019 10:16
Vuetify Installation on Laravel Mix
let mix = require('laravel-mix');
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
Init:
---------------------------------------------------------------
let collection = await db.collection({
name: 'contacts',
schema: contactsMeta.schema,
migrationStrategies: contactsMeta.migrations,
statics: contactsMeta.statics,
methods: contactsMeta.methods,
});
middleware.preCreate(collection);
let t = document.querySelector("table tbody")
let tr = t.querySelectorAll("tr td[align]=right")
arr = []
tr.forEach(function(d){
if(d['align'] === 'right'){
let countString = d['innerHTML']
if(typeof countString === 'string'){
let split = countString.split(",")
let joined = split.join("")
let count = Number.parseFloat(joined)