Skip to content

Instantly share code, notes, and snippets.

View subhanahmed047's full-sized avatar
🎯
Focusing

Subhan Ahmed subhanahmed047

🎯
Focusing
View GitHub Profile
@subhanahmed047
subhanahmed047 / routes.php
Created June 11, 2016 13:43
Routes for my users plugin
Router::prefix('admin', function ($routes) {
$routes->plugin(
'IncUsers',
['path' => '/users'],
function (RouteBuilder $routes) {
$routes->fallbacks('DashedRoute');
$routes->connect('/login/', ['controller' => 'Users', 'action' => 'login']);
$routes->connect('/register/', ['controller' => 'Users', 'action' => 'add']);
$routes->connect('/logout/', ['controller' => 'Users', 'action' => 'logout']);
@subhanahmed047
subhanahmed047 / routes.php
Last active June 12, 2016 15:35
Some actions in admin prefix some in /
Router::scope('/', function ($routes) {
$routes->plugin(
'IncUsers',
['path' => '/'],
function (RouteBuilder $routes) {
$routes->connect('/login/', ['controller' => 'Users', 'action' => 'login']);
$routes->connect('/register/', ['controller' => 'Users', 'action' => 'add']);
$routes->fallbacks('DashedRoute');
});
});
<?php
/**
* Routes configuration
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different URLs to chosen controllers and their actions (functions).
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<?php
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
Router::prefix('admin', ['_namePrefix'=>'admin:'], function ($routes) {
$routes->scope('/users', ['plugin'=>'IncUsers', 'controller'=> 'Users', '_namePrefix'=>'users:'], function ($routes) {
$routes->connect('/', ['action'=>'index'], ['_name'=>'index']);
$routes->connect('/add', ['action'=>'add'], ['_name'=>'add']);
$routes->connect('/edit/:id', ['action'=>'edit'], ['pass'=>['id'], 'id'=>'[[:xdigit:]-]+', '_name'=>'edit']);
$routes->connect('/profile/:id', ['action'=>'view'], ['pass'=>['id'], 'id'=>'[[:xdigit:]-]+', '_name'=>'profile']);
<?php
return $default = [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
<?php
namespace IncCart\Controller\Component;
use Cake\Controller\Component;
/**
* Created by PhpStorm.
* User: Subhan Ahmed
* Date: 5/29/2016
<?php
use Cake\Datasource\ConnectionManager;
$datasource_json = ROOT . DS . "plugins" . DS . "Settings" . DS . "config" . DS . "datasource.json";
$content = json_decode(file_get_contents($datasource_json), true);
debug($content);
if(empty($content['password'])){
$dsn = "mysql://".$content['username']."@".$content['host']."/".$content['database'];
} else{
$dsn = "mysql://".$content['username'].":".$content['password']."@".$content['host']."/".$content['database'];
isCodeExist(code: string): Observable<Job[]> {
return <Observable<Job[]>>this.afs
.collection(this.jobsCollection, ref => ref
.where('code', '==', code)
.limit(1)
)
.valueChanges()
.pipe(
flatMap(jobs => jobs),
catchError(err => throwError(err)
@subhanahmed047
subhanahmed047 / cloud-build-config.js
Created October 4, 2018 05:00
Cloud Build Config
import * as Constants from './build-constants';
const environments = {
production: Constants.PRODUCTION,
staging: Constants.STAGING,
dev: Constants.DEV,
dev2: Constants.DEV2,
};
const currentEnvironment = environments.staging;
Subhans-MacBook-Pro:TVMLCatalog.xcodeproj subhanahmed$ xcodebuild -sdk appletvos -configuration Release -workspace project.xcworkspace -scheme TVMLCatalog build CODE_SIGN_STYLE=Manual
Build settings from command line:
CODE_SIGN_STYLE = Manual
SDKROOT = appletvos12.4
note: Using new build system
note: Planning build
note: Using build description from disk
Build system information
warning: Provisioning profile "7plus tvOS TopShelf Distribution" for "TopShelf" contains entitlements that aren't in the entitlements file: com.apple.smoot.subscriptionservice. To use these entitlements, add them to your entitlements file. Otherwise, remove unused entitlements from your provisioning profile. (in target 'TopShelf')