Skip to content

Instantly share code, notes, and snippets.

View DavidStrada's full-sized avatar
:octocat:
Full StackOverflow Developer

David DavidStrada

:octocat:
Full StackOverflow Developer
View GitHub Profile
@DavidStrada
DavidStrada / eager-loading.twig
Created September 7, 2021 23:56 — forked from Chrisedmo/eager-loading.twig
#CraftCMS: Eager-Load Nested Sets of Elements
{#
According to docs (https://craftcms.com/docs/templating/eager-loading-elements),
this is how you Eager-Load Nested Sets of Elements
#}
{% set entries = craft.entries({
section: 'news',
with: [
'entriesField.assetsField'
]
@DavidStrada
DavidStrada / UploadFileComponent.vue
Last active June 6, 2019 16:03
upload file / submit form via Vuejs Statamic
<template>
<form action="#" @submit.prevent="submitForm">
<div class="form-group">
<label for="my-input">Text</label>
<input
id="my-input"
class="form-control"
type="file"
ref="fileUpload"
@change="handleFileUpload"
@DavidStrada
DavidStrada / AppServiceProvider.php
Created May 16, 2019 17:37 — forked from simonhamp/AppServiceProvider.php
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
fields:
test_addon:
type: test
validate: required
@DavidStrada
DavidStrada / settings.yaml
Last active March 24, 2017 16:11
emd settings
fields:
mailchimp_key:
type: text
validate: required
user_section:
type: section
display: Users
add_new_users:
type: toggle
display: Add New Users?
// Theme Styles
@import 'theme/style';
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
protected $fillable = ['name', 'content'];
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
protected $fillable = ['name', 'content'];
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
protected $fillable = ['name', 'content'];
var p1 = new Promise((resolve, reject) => {
setTimeout(resolve, 1000, "one");
});
var p2 = new Promise((resolve, reject) => {
setTimeout(resolve, 2000, "two");
});
var p3 = new Promise((resolve, reject) => {
setTimeout(resolve, 3000, "three");
});
var p4 = new Promise((resolve, reject) => {