Skip to content

Instantly share code, notes, and snippets.

View chriscalip's full-sized avatar

Christopher Calip chriscalip

  • Chicago, IL
  • 13:17 (UTC -05:00)
View GitHub Profile
<?php
namespace App\DataTables;
use App\Asset;
use Yajra\DataTables\Services\DataTable;
class AssetsDataTable extends DataTable
{
/**
<?php
namespace App\DataTables;
use App\Asset;
use Yajra\DataTables\Services\DataTable;
class AssetsDataTable extends DataTable
{
/**
$.ajax({
url: '/get/emloyer/viewJob',
method: 'GET',
data: {
'jobid' : jobid,
}
}).done(function(data){
console.log(data);
});
@chriscalip
chriscalip / test.html
Created September 27, 2017 18:41
using laravel-json-api demo update resource attempt. chriscalip@raptor:~/projects$ curl -H 'content-type: application/json' -v -X PUT -d '{"title": "XXX"}' http://cc.demo/api/v1/posts/1 > test.html
<!DOCTYPE html><!--
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: in file /home/vagrant/code/cc-demo/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php on line 251
Stack trace:
1. Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException-&gt;() /home/vagrant/code/cc-demo/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:251
2. Illuminate\Routing\RouteCollection-&gt;methodNotAllowed() /home/vagrant/code/cc-demo/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:238
3. Illuminate\Routing\RouteCollection-&gt;getRouteForMethods() /home/vagrant/code/cc-demo/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:176
4. Illuminate\Routing\RouteCollection-&gt;match() /home/vagrant/code/cc-demo/vendor/laravel/framework/src/Illuminate/Routing/Router.php:584
5. Illuminate\Routing\Router-&gt;findRoute() /home/vagrant/code/cc-demo/vendor/laravel/framework/src/Illuminate/Routing/Router.php:563
@chriscalip
chriscalip / PostsController.php
Created September 27, 2017 18:34
laravel-api-json Post Controller
<?php
namespace App\Http\Controllers\Api;
use App\JsonApi\Posts;
use App\Post;
use CloudCreativity\LaravelJsonApi\Http\Controllers\EloquentController;
use CloudCreativity\LaravelJsonApi\Http\Controllers\CreatesResponses;
use CloudCreativity\JsonApi\Contracts\Object\ResourceObjectInterface;
chriscalip@raptor:~/projects/codes/lumen-5.5.0$ grep -R getRoutes *
vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php: if (isset($this->router->getRoutes()[$method.$pathInfo])) {
vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php: return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php: foreach ($this->router->getRoutes() as $route) {
vendor/laravel/lumen-framework/src/Routing/Router.php: public function getRoutes()
chriscalip@raptor:~/projects/codes/lumen-5.3.0$ grep -R getRoutes *
vendor/laravel/lumen-framework/tests/FullApplicationTest.php: $route = $app->getRoutes()['GET/test'];
vendor/laravel/lumen-framework/tests/FullApplicationTest.php: $routes = $app->getRoutes();
vendor/laravel/lumen-framework/tests/FullApplicationTest.php: $routes = $app->getRoutes();
@chriscalip
chriscalip / gist:58afae770105559e0f01cb6d8afc3972
Created August 15, 2017 17:59
Drupal 8, Is it possible to override current-user for token replace purposes?
$token = Drupal::token();
$text = 'New [node:content-type] created: [node:title] [current-user:display-name]';
$node = node_load(80044);
$user = user_load(2);
$token->replace($text, ['node' => $node, 'current-user' => $user]);
@chriscalip
chriscalip / settings.php
Created August 2, 2017 16:56
Updated settings.php to include settings.local.php and settings.devforpantheon.php
<?php
/**
* Load services definition file.
*/
$settings['container_yamls'][] = __DIR__ . '/services.yml';
/**
* Include the Pantheon-specific settings file.
*
@chriscalip
chriscalip / settings.devforpantheon.php
Created August 2, 2017 16:30
Inspired by settings.pantheon.php; the idea is to use settings file to diverge configurations between environments.
<?php
/**
* @file
* Capacitype Overrides for Pantheon environment configuration file.
*
* This enforces logic that for all pantheon environments the following gets enforced :
* a.) Except for live envinroment, sending mail as logs in devel temp directory.
* b.) Search API algolia : assets2algolia & topics2algolia are only enabled on LIVE pantheon envinroments.
* c.) Enforce find-it active search index for live environment only.
@chriscalip
chriscalip / README.md
Created May 4, 2017 01:10
Sample Drupal 8 Feature documentation for situations where codebase is all over the place.

Capacitype Collection Feature List.

Feature: [Collection content should be visible only to author by default][1]

Description

Collection nodes are visible only to the author node and users with permission "bypass node access"

Feature Manifest