Skip to content

Instantly share code, notes, and snippets.

View chart.js
import React from 'react';
import PropTypes from 'prop-types';
import {t} from 'app/locale';
import SentryTypes from 'app/sentryTypes';
import {getInterval, useShortInterval} from 'app/components/charts/utils';
import {getFormattedDate} from 'app/utils/dates';
import EventsRequest from 'app/views/organizationEvents/utils/eventsRequest';
import LineChart from 'app/components/charts/lineChart';
import MarkLine from 'app/components/charts/components/markLine';
View sample-data.sql
/*
SQLyog Ultimate v12.15 (64 bit)
MySQL - 5.7.24-0ubuntu0.18.04.1 : Database - pim_cake
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
@markstory
markstory / BugShell.php
Created Nov 11, 2018
CakePHP Issue 12485 repo
View BugShell.php
<?php
namespace App\Shell;
use Cake\Console\Shell;
use Cake\ORM\TableRegistry;
class BugShell extends Shell
{
public function main()
{
View delete-project-group-index.md
title sidebar_order
Bulk Remove a List of Issues
5

DELETE /api/0/projects/{organization_slug}/{project_slug}/issues/

: Permanently remove the given issues. The list of issues tomodify is given through the id query parameter. It is repeatedfor each issue that should be removed.Only queries by 'id' are accepted.If any ids are out of scope this operation will succeed withoutany data mutation.

@markstory
markstory / bool-type-effected
Created Jul 6, 2018
Methods effected by bool type changes.
View bool-type-effected
// List built with
// ack --noheading 'return.*\|bool' src/
// ack --noheading 'return.*bool\|' src/
src/Auth/BaseAuthenticate.php:113: * @return bool|array Either false on failure, or an array of user data.
src/Auth/DefaultPasswordHasher.php:44: * @return bool|string Password hash or false on failure
src/Auth/DigestAuthenticate.php:135: * @return array|bool Array of digest information.
src/Cache/CacheEngine.php:153: * @return bool|int New incremented value, false otherwise
src/Cache/CacheEngine.php:162: * @return bool|int New incremented value, false otherwise
src/Cache/CacheEngine.php:248: * @return bool|string string key or false
View bootstrap.php
<?php
// In config/bootstrap.php
use Cake\I18n\I18n;
use Cake\I18n\ChainMessagesLoader;
use Cake\I18n\MessagesFileLoader;
// Turn off 'default' as a fallback
I18n::translators()->useFallback(false);
// Create a custom fallback.
@markstory
markstory / Marshaller.php.diff
Created Sep 12, 2017
Should the Marshaller warn on 'extra' properties. We could log, but it will add a dependency to the ORM package.
View Marshaller.php.diff
diff --git a/src/ORM/Marshaller.php b/src/ORM/Marshaller.php
index e4a1894..f7c092b 100644
--- a/src/ORM/Marshaller.php
+++ b/src/ORM/Marshaller.php
@@ -16,6 +16,7 @@ namespace Cake\ORM;
use ArrayObject;
use Cake\Collection\Collection;
+use Cake\Core\Configure;
use Cake\Database\Expression\TupleComparison;
View AlgoliaBehavior.php
<?php
namespace App\Model\Behavior;
use Cake\ORM\Behavior;
class AlgoliaBehavior extends Behavior
{
protected $_defaultConfig = [
'index' => '',
// Other Algolia API key configuration
View TreeBehaviorNumberTest.php
<?php
// This test method was added to the bottom of lib/Cake/TestCase/Model/Behavior/TreeBehaviorNumberTest.php
public function testSaveRecursiveTree() {
extract($this->settings);
$this->Tree = new $modelClass();
$this->Tree->Behaviors->attach('Tree', array('level' => 'level'));
$this->completeTreeSave(array(
'app' => array(
'GroupPermissions' => array(
View TimeSheetsFixture.php
<?php
namespace App\Test\Fixture;
use Cake\TestSuite\Fixture\TestFixture;
/**
* TimeSheetsFixture
*
*/
class TimeSheetsFixture extends TestFixture
You can’t perform that action at this time.