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
@R-jee
R-jee / overlay.html
Last active June 10, 2022 09:55 — forked from nandoflorestan/overlay.html
jQuery: Click an image to show it big on a viewport-sized modal overlay
<html>
<head>
<title>jQuery: Click an image to show it big on a viewport-sized modal overlay
</title>
</head>
<body>
<p>
<img class="zoomable" style='width:40%;' src="http://www.tumblr.com/photo/1280/artedaalma/19707693049/1/tumblr_m19h2mwFRQ1rsn8cy" />
</p>
<p>
@R-jee
R-jee / getWeeksInMonth.js
Created August 16, 2022 11:25 — forked from markthiessen/getWeeksInMonth.js
JavaScript - get weeks in a month as array of start and end days
//note: month is 0 based, just like Dates in js
function getWeeksInMonth(year, month) {
const weeks = [],
firstDate = new Date(year, month, 1),
lastDate = new Date(year, month + 1, 0),
numDays = lastDate.getDate();
let dayOfWeekCounter = firstDate.getDay();
for (let date = 1; date <= numDays; date++) {
/*
* Try to login, check the login credentials, and then redirect if required.
*/
login(email, password).done(function (html) {
if (html.indexOf('Invalid login credentials') !== -1) {
// invalid password - show a message to the user
} else {
// All good! Let's redirect if required
var checkoutUrl = getCheckoutUrl();
@R-jee
R-jee / install-ngrok-ubuntu.md
Created February 15, 2023 05:42 — forked from akamit21/install-ngrok-ubuntu.md
How to install ngrok on Ubuntu

What is ngrok?

ngrok is a reverse proxy that creates a secure tunnel from a public endpoint to a locally running web service. ngrok captures and analyzes all traffic over the tunnel for later inspection and replay.

ngrok secure introspectable tunnels to localhost

ngrok - secure introspectable tunnels to localhost (homepage) "I want to expose a local server behind a NAT or firewall to the Internet."

Enable snapd

If you’re running Ubuntu 16.04 LTS (Xenial Xerus) or later, including Ubuntu 18.04 LTS (Bionic Beaver) and Ubuntu 20.04 LTS (Focal Fossa), you don’t need to do anything. Snap is already installed and ready to go.

apt-get update
apt-get upgrade
apt install -y nginx
systemctl enable nginx
systemctl start nginx
apt-add-repository ppa:ondrej/php -y
systemctl enable php7.4-fpm
systemclt start php7.4-fpm
apt install -y php7.4 php7.4-{cli,gd,curl,mysql,ldap,zip,fileinfo,fpm,xml,mbstring,exif,pspell,imagick,bcmath}
apt install mariadb-server mariadb-client
/**
* 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');
@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',
@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 / 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 / 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;