Skip to content

Instantly share code, notes, and snippets.

@tebajanga
tebajanga / detached-head-merge.ps1
Created March 30, 2018 08:09 — forked from cmatskas/detached-head-merge.ps1
Git merge detached head
$git checkout –b temp #makes a new branch from current detached HEAD
$git branch –f master temp #update master to point to the new <temp> branch
$git branch –d temp #delete the <temp> branch
$git push origin master #push the re-established history
@tebajanga
tebajanga / GitHub-Forking.md
Created May 22, 2018 22:56 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@tebajanga
tebajanga / request_no_curl.php
Created August 27, 2018 12:53 — forked from iNaD/request_no_curl.php
Sending a GET/POST Request via PHP without CURL (fopen needs to be enabled)
<?php
$url = 'http://server.com/path';
$data = array('key1' => 'value1', 'key2' => 'value2');
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
@tebajanga
tebajanga / Content.js
Created November 29, 2018 05:35
Removing Specific Element in Array React
import React, { Component } from 'react';
import * as _ from 'lodash';
class Content extends Component {
state = {
products: [ {id: 1, name: 'some name'},
{ id: 2, name: 'some other name'},
{ id: 3, name: 'some other name 2'},
{ id: 4, name: 'other stuff'},
@tebajanga
tebajanga / Permission.sh
Last active June 2, 2020 19:56
Adding permission to web folder in Ubuntu
sudo chgrp -R www-data /var/www/html/
sudo find /var/www/html/ -type d -exec chmod g+rx {}
sudo find /var/www/html/ -type d -exec chmod g+rx {} +
sudo find /var/www/html/ -type f -exec chmod g+r {} +
sudo chown -R $USER /var/www/html/
sudo find /var/www/html/ -type d -exec chmod g+s {} +
# Run these commands also, when above commands does not work
sudo usermod -a -G www-data $USER
sudo find /var/www/html/ -type d -exec chmod 775 {} \;
<?php
// Turn on debugging level
$Vtiger_Utils_Log = true;
include_once 'vtlib/Vtiger/Module.php';
error_reporting(E_ALL);
ini_set("display_errors", "on");
$current_user = Users::getActiveAdminUser();
include_once 'modules/cbQuestion/cbQuestion.php';
$qid = 0;
@tebajanga
tebajanga / LaravelInstaller.sh
Last active February 27, 2019 22:36
Installing Laravel Globally by using Composer for Ubuntu
# Getting composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
# Changing permission for .composer directory
sudo chown -R $USER ~/.composer/
# Installing Laravel Global
composer global require "laravel/installer"
# Adding composer to system PATH
@tebajanga
tebajanga / postgres-cheatsheet.md
Created March 25, 2019 22:27 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@tebajanga
tebajanga / Procfile
Created October 19, 2019 21:48 — forked from sdrew/Procfile
Laravel configs for Heroku/Dokku
web: vendor/bin/heroku-php-apache2 public/
# Last commit
git log master..{branch_name} --oneline | tail -1
# First commit
git log master..{branch_name} --oneline | head -1