Skip to content

Instantly share code, notes, and snippets.

@sdevore
sdevore / UnitModel.js
Last active July 8, 2021 17:48
how is available defined
get available () {
const status = this.status.toLowerCase()
// if the date is essentially empty then
if (['', '0000-00-00'].includes(this.when_available.trim())) {
// if the status contains `not ready` then show `Coming Soon`
if (status.indexOf('not ready') !== -1) {
return 'Coming Soon'
}
// other wise it is `Available`
return 'Available'
@sdevore
sdevore / CommentForm.vue
Created November 27, 2019 21:23 — forked from JamesRagonesi/CommentForm.vue
Reusable form with Vuex ORM
<form v-model="$v.valid" @submit.prevent="submit">
<input
type="text"
v-model.trim="$v.form.text.$model"
@input="$v.form.text.$touch()"
@blur="$v.form.text.$touch()"
/>
<button @click="submit">Submit</button>
</form>
@sdevore
sdevore / Comment.js
Created November 27, 2019 21:23 — forked from JamesRagonesi/Comment.js
Reusable Forms - Model
import { Model } from "@vuex-orm/core";
import { required, maxLength, minLength } from "vuelidate/lib/validators";
export default class Comment extends Model {
static fields() {
return {
id: this.attr(null),
text: this.string(""),
};
}
{
"require": {
"sdevore/cakephp-scid-plugin": "dev-feature/bootstrap-4",
},
"repositories": [
{
"type": "vcs",
"url": "git@github.com:sdevore/cakephp-scid-plugin.git"
},
],
<?php
namespace App\Mailer\Preview;
use Cake\Core\Configure;
use Cake\ORM\Locator\LocatorAwareTrait;
use DebugKit\Mailer\MailPreview;
class UsersMailPreview extends MailPreview
{
use LocatorAwareTrait;
$query = $articles->find()
->where(['title LIKE' => '%First%'])
->andWhere(function ($exp) {
return $exp->or_([
'author_id' => 2,
'is_highlighted' => true
]);
});

Keybase proof

I hereby claim:

  • I am sdevore on github.
  • I am sdevore (https://keybase.io/sdevore) on keybase.
  • I have a public key ASDZB-mhOIoxQbSh7DVOkoayQGDexOpkygXH23jEfSU6Sgo

To claim this, I am signing this object:

<?php // in a model
if (empty($this->_modelWithCustomSource)) {
App::import('Model', 'MyPlugin.MyPluginModel');
$this->_modelWithCustomSource = new MyPluginModel();
$this->_modelWithCustomSource->useDbConfig; // is an instance of the datasouce
}

Keybase proof

I hereby claim:

  • I am sdevore on github.
  • I am sdevore (https://keybase.io/sdevore) on keybase.
  • I have a public key whose fingerprint is E401 1523 7B80 83E6 04FE 2A7B 8EB7 6206 EE25 10A2

To claim this, I am signing this object:

@sdevore
sdevore / 0_reuse_code.js
Created January 30, 2014 04:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console