Skip to content

Instantly share code, notes, and snippets.

View dbjpanda's full-sized avatar

Dibyajyoti dbjpanda

  • India
View GitHub Profile
@dbjpanda
dbjpanda / google-api.php
Last active October 22, 2024 09:33
Google API Ouath2 authentication using PHP and Curl
<?php
$end_point = 'https://accounts.google.com/o/oauth2/v2/auth';
$client_id = 'YOUR_ID';
$client_secret = 'YOUR_SECRET';
$redirect_uri = 'http://'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]'; // http://'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"] or urn:ietf:wg:oauth:2.0:oob
$scope = 'https://www.googleapis.com/auth/drive.metadata.readonly';
$authUrl = $end_point.'?'.http_build_query([
@dbjpanda
dbjpanda / add-tab-to-ultimate-profile.php
Last active November 15, 2019 06:34 — forked from ultimatemember/gist:8cdaf61e7bd9de35512c
Extending Ultimate Member Profile Menu using Hooks
/* First we need to extend main profile tabs */
add_filter('um_profile_tabs', 'add_custom_profile_tab', 1000 );
function add_custom_profile_tab( $tabs ) {
$tabs['mycustomtab'] = array(
'name' => 'My custom tab',
'icon' => 'um-faicon-comments',
);
@dbjpanda
dbjpanda / gist:9e6f0d924668b23da9ba4e12a76feb63
Created September 21, 2019 20:49 — forked from ultimatemember/gist:8cdaf61e7bd9de35512c
Extending Ultimate Member Profile Menu using Hooks
/* First we need to extend main profile tabs */
add_filter('um_profile_tabs', 'add_custom_profile_tab', 1000 );
function add_custom_profile_tab( $tabs ) {
$tabs['mycustomtab'] = array(
'name' => 'My custom tab',
'icon' => 'um-faicon-comments',
);
@dbjpanda
dbjpanda / schema.php
Created August 25, 2019 22:21
Schema.org addtions for better SEO - Function for WordPress
/**
* Schema.org addtions for better SEO
* @param string Type of the element
* @return string HTML Attribute
*/
function get_schema_markup($type, $echo = false) {
if (empty($type)) return false;
<script>
( function( $ ) {
$( window ).load(function() {
$('.no-content > div ').css("visibility","visible");
$('.content-placeholder').removeClass('content-placeholder');
});
} )( jQuery );
#cloud-config
package_update: true
package_upgrade: true
groups:
- docker: [default]
#include https://gist.githubusercontent.com/dbjpanda/042d385443fc62411e152f4e33d06089/raw/docker-install.sh
#!/usr/bin/env bash
PROJECT_NAME=${TRAVIS_REPO_SLUG#*/}-${TRAVIS_BRANCH}-$RANDOM
ssh -o StrictHostKeyChecking=no "${DEPLOY_USER}"@"${SERVER_IP}" << EOF
echo "#################################################################################################################"
if [ \$(docker network ls | grep -c traefik-network) == 0 ]; then
echo "Creating traefik network"
package main
import (
"io/ioutil"
"fmt"
"strings"
"net/http"
)
var entries = []string{}
@dbjpanda
dbjpanda / subdomains.go
Created June 12, 2018 23:16 — forked from ahmdrz/subdomains.go
How to use SubDomains in Golang , Subdomains With Go , http://codepodu.com/subdomains-with-golang/
//
// Please read http://codepodu.com/subdomains-with-golang/
// It's just copy and paste :smile:
//
//
// URLs :
// http://admin.localhost:8080/admin/pathone
// http://admin.localhost:8080/admin/pathtwo
// http://analytics.localhost:8080/analytics/pathone
// http://analytics.localhost:8080/analytics/pathtwo
# from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements
FROM php:7.2-fpm-alpine
# install the PHP extensions we need
# postgresql-dev is needed for https://bugs.alpinelinux.org/issues/3642
RUN set -ex \
&& apk add --no-cache --virtual .build-deps \
coreutils \
freetype-dev \
libjpeg-turbo-dev \