Skip to content

Instantly share code, notes, and snippets.

View jaynarayan89's full-sized avatar

jaynarayan jaynarayan89

  • vapi ,gujarat , India
View GitHub Profile
git remote add upstream /url/to/original/repo
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force
git update-index should do what you want
This will tell git you want to start ignoring the changes to the file
git update-index --assume-unchanged path/to/file
When you want to start keeping track again
git update-index --no-assume-unchanged path/to/file
git push origin --delete the_remote_branch
git fetch upstream
git checkout develop
git merge upstream/develop
git merge upstream/develop
git push origin develop
git add -A stages All
git add . stages new and modified, without deleted
git add -u stages modified and deleted, without new
unstaged file
git reste <filepath>
command to ignore file
This will tell git you want to start ignoring the changes to the file
SELECT concat('alter table ',table_schema,'.',table_name,' DROP FOREIGN KEY ',constraint_name,';')
FROM information_schema.table_constraints
WHERE constraint_type='FOREIGN KEY'
AND table_schema='!!YOUR_SCHEMA_HERE!!';
@jaynarayan89
jaynarayan89 / AppController.php
Created December 6, 2017 06:46
Working custom atuh for php
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<?php
use Migrations\AbstractSeed;
/**
* Customers seed.
*/
class CustomersSeed extends AbstractSeed
{
/**
* Run Method.
@jaynarayan89
jaynarayan89 / 20170926205038_create_posts_table.php
Last active December 8, 2017 20:00
sample migration file
<?php namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Migration_create_posts_table extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
@jaynarayan89
jaynarayan89 / gist:87bfad6f4203088f8d513fe30e0c2041
Created March 9, 2018 06:21
thoughts about decorator pattern
lorenzo [9:27 PM]
I sued decorator for a bunch of stuff, but where it is more obvious is in the result set
the statement object is a decorator for pdo statement
the code that casts the results to the right type (int, dates…) is a decorator of the statement
the code that converts the rows to entities is a decorator of the statement…
formatResults is a decorator of the result set