Skip to content

Instantly share code, notes, and snippets.

View R-jee's full-sized avatar
🎖️
Focusing

Rana Umair R-jee

🎖️
Focusing
View GitHub Profile

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

<?php
class CustomerAddress extends Model {
protected function setKeysForSaveQuery(Builder $query)
{
$query
->where('Customer_No', '=', $this->getAttribute('Customer_No'))
->where('Address_Name', '=', $this->getAttribute('Address_Name'));
@R-jee
R-jee / PHP CURL POST REQUEST WITH FILE
Created August 1, 2023 08:30 — forked from azhar25git/PHP CURL POST REQUEST WITH FILE
Send file with POST request via CURL PHP 7
<?php
// You have to enable PHP CURL extension
//Initialise the cURL var
$ch = curl_init();
// Path of the file
$file_uri = realpath('cat.zip');
// Creates a CURLFile object, used to upload a file with CURLOPT_POSTFIELDS.
@R-jee
R-jee / Upload to Google Drive via PHP
Created August 1, 2023 08:30 — forked from azhar25git/Upload to Google Drive via PHP
Upload to your Google Drive via PHP Script
<?php
// error_reporting( E_ALL );
// you need to get Google OAuth Client Package with this command: composer require google/apiclient:"^2.0"
require __DIR__ . '/vendor/autoload.php';
// Credentials for your Drive App created on https://console.cloud.google.com
$clientId = 'xxxxxxapps.googleusercontent.com';
$clientSec = 'xxxxxxxx';
// Get access tokens from https://developers.google.com/oauthplayground using your Own Client ID and Cilent Secret
@R-jee
R-jee / get domain without subdomain.php
Created August 1, 2023 08:30 — forked from azhar25git/get domain without subdomain.php
PHP code to get the domain name without subdomains (includes the tld, and the special types from IANA). Don't have support for unicode domain names.
<?php
/**
* @param string $domain Pass $_SERVER['SERVER_NAME'] here
* @param bool $debug
*
* @debug bool $debug
* @return string
*/
function get_domain($domain, $debug = false)
{
@R-jee
R-jee / User.php
Created August 1, 2023 08:30 — forked from azhar25git/User.php
app/User.php
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
@R-jee
R-jee / next_nginx.md
Created August 1, 2023 08:28 — forked from azhar25git/next_nginx.md
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@R-jee
R-jee / datalayer code for shopify
Last active March 16, 2023 07:25 — forked from bilalnaseer/datalayer code for shopify
data layer code for shopify
<script>
var gtmId = "GTM-P2LDDTT";
(function() {
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
// Prevent double-tracking if an upsell is seen or the order status page has been seen
{% if first_time_accessed == true and post_purchase_page_accessed == false %}
var checkout = window.Shopify.checkout;
@R-jee
R-jee / datalayer code for shopify
Created March 16, 2023 06:27 — forked from bilalnaseer/datalayer code for shopify
data layer code for shopify
{% if first_time_accessed %}<script>
window.dataLayer = window.dataLayer || [];
var shipping_price = '{{shipping_price | money_without_currency }}';
shipping_price = shipping_price.replace(",", ".");
var total_price = '{{total_price | money_without_currency }}';
total_price = total_price.replace(",", ".");
var tax_price = '{{tax_price | money_without_currency }}';
tax_price = tax_price.replace(",", ".");
window.dataLayer.push({
'page_type': 'purchase',
/**
* PaymentController
*
* @description :: Server-side actions for handling incoming requests.
* @help :: See https://sailsjs.com/docs/concepts/actions
*/
var moment = require('moment');
var request = require('request');
var sortKeys = require('sort-keys');