Skip to content

Instantly share code, notes, and snippets.

View tranepura's full-sized avatar
😃

Thushara Ranepura tranepura

😃
View GitHub Profile
@tranepura
tranepura / .env
Last active November 12, 2021 02:35
Docker for Drupal custom .env file
### Documentation available at https://wodby.com/docs/stacks/drupal/local
### Changelog can be found at https://github.com/wodby/docker4drupal/releases
### Images tags format explained at https://github.com/wodby/docker4drupal#images-tags
### PROJECT SETTINGS
PROJECT_NAME=myskills_new
PROJECT_BASE_URL=myskills.dev.local
PROJECT_BASE_URL_PORTAL=portal.myskills.dev.local
COMPOSE_CONVERT_WINDOWS_PATHS=1
@tranepura
tranepura / docker-compose.yml
Last active November 12, 2021 02:35
Docker4 Drupal custom docker compose for WSL
version: "3.7"
services:
mariadb:
image: wodby/mariadb:$MARIADB_TAG
container_name: "${PROJECT_NAME}_mariadb"
stop_grace_period: 30s
ports:
- "3306:3306"
environment:
@tranepura
tranepura / header
Last active August 16, 2016 06:24
header template
<header id = "navbar" role = "banner" class = "navbar navbar-static-top navbar-default">
<div class = "container">
<div class = "navbar-header">
<!---->
<!--<a class = "name navbar-brand" href = "/" title = "Home">ma-drupal.dev</a>
-->
<a href = "/" title = "Home">
<div id = "navbarhome" class = "name navbar-brand glyphicon glyphicon-home"></div> </a>
<!--.btn-navbar is used as the toggle for collapsed navbar content -->
@tranepura
tranepura / wheretouseyourcard
Created July 26, 2016 00:34
Markup for Where to use your card
<?php
$collected_results_array = array();
$marker_data = array();
$i = 0;
$result = db_query($google_sql);
if ($result) {
while ($record = $result->fetchObject()) {
$markerObject = new stdClass();
$i++;
@tranepura
tranepura / data insert to db
Created July 5, 2016 01:37
Insert AC API data from JSON to Drupal tables
$url = 'https://www.ambassadorcard.com.au/api/resync/?return_type=json';
//$url = 'https://www.ambassadorcard.com.au/api/added/?return_type=json&benefit_type=Dining&start_dt=2016-01-01';
//$url = 'https://www.ambassadorcard.com.au/api/removed/?return_type=xml&benefit_type=Dining&start_dt=2016-01-01';
//$url = "https://www.ambassadorcard.com.au/api/updated/?return_type=json&benefit_type=Dining&start_dt=2016-01-01";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
<script type="text/javascript">
var currenturl = window.location.href;
var url = "p=75";
if (currenturl.indexOf("p=75") != -1)
{
var trimurl = currenturl.replace('p=75', '');
customAlert();
}
@tranepura
tranepura / encoded.php
Last active November 18, 2015 22:36
Script to decode 64base encoded query string to a object for database insert
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
?>
<?php
/**
* Updates the current groups information shown about a user when a user is selected.
*
* @global {Array} userSummaries
* userSummaries is added to the page via /user/selector/lib.php - group_non_members_selector::print_user_summaries()
* as a global that can be used by this function.
*/
function updateUserSummary() {
var selectEl = document.getElementById('addselect'),
summaryDiv = document.getElementById('group-usersummary'),
@tranepura
tranepura / MDL-29774 Fix lib.php
Created May 31, 2015 11:58
Fix for MDL -29774 Fix
/**
* Creates a global JS variable (userSummaries) that is used by the group selector
* to print related information when the user clicks on a user in the groups UI.
*
* Used by /group/clientlib.js
*
* @global moodle_database $DB
* @global moodle_page $PAGE
* @param int $courseid
*/
@tranepura
tranepura / class.MainTaxSettings.php
Created April 21, 2015 05:28
To remove global variable $tax_config from conn.php ticket #2129
<?php
/*
* Ticket #2129
* Remove Global Variable $tax_settings from conn.php
*
*/
class MainTaxSettings{