Skip to content

Instantly share code, notes, and snippets.

@shabaz-ejaz
shabaz-ejaz / global template variable
Last active October 16, 2018 13:13
Global template variables
To set a global template variable create one for the homepage template and access it anywhere like this:
[[getImageList?
&tvname=`footerServicesProvidedLinks`
&tpl=`footerServicesProvidedLinkItem.tpl`
&docid=`1`
]]
The &docid=`1` is accessing the TV from the homepage (homepage has id = 1)
@shabaz-ejaz
shabaz-ejaz / ssh keygen
Last active October 16, 2018 13:13
SSH Keygen
ssh-keygen -t rsa -b 4096 -C "shabaz@scorchsoft.com"
@shabaz-ejaz
shabaz-ejaz / folder permissions scripts
Created July 10, 2017 11:36
Update folder permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
@shabaz-ejaz
shabaz-ejaz / composer
Created July 10, 2017 11:36
Install composer on server
curl -sS https://getcomposer.org/installer | php
php composer.phar install
@shabaz-ejaz
shabaz-ejaz / map_with_index.js
Created July 12, 2017 09:17
Map function with index
{survey.data.questions.map((item, index) => (
<Step>
<StepButton onClick={() => this.setState({ stepIndex: index })}>
{item.question_category}
</StepButton>
</Step>
))}
@shabaz-ejaz
shabaz-ejaz / change remote origin
Created July 14, 2017 16:09
Change remote origin
git remote set-url origin https://shabazejaz@bitbucket.org/scorchsoft/epitomise-api.git
@shabaz-ejaz
shabaz-ejaz / new_gist_file_0
Created July 25, 2017 15:21
Clear local storage in IE11
Run the following in the developers console:
localStorage.clear();
sessionStorage.clear();
@shabaz-ejaz
shabaz-ejaz / new_gist_file_0
Created July 31, 2017 13:37
Google Analytics Scripts
import ReactGA from 'react-ga';
const ga = ReactGA.ga();
ga('send', 'event', 'programme', 'injury', 'report injury');
@shabaz-ejaz
shabaz-ejaz / Join query.php
Last active October 16, 2018 13:11
Yii2 Join tables with ActiveRecord
$products = AirtablesProduct:: find()
->with('airtablesProductsTypes.airtablesProductType')
->with('airtablesProductsComponents.airtablesComponent')
->with('airtablesProductsSizes.airtablesProductSize')
->with('airtablesProductsSpecies.airtablesSpecie')
->orderBy('name ASC')
->asArray();
@shabaz-ejaz
shabaz-ejaz / uncontrolled_input.jsx
Created August 16, 2017 16:07
Uncontrolled input component
<Form.Field defaultValue={this.state.searchFreeText} icon={{ name: 'search' }} onBlur={this.handleFreeTextSearchChange.bind(this)} control={Input} width={4} label="Search for:" placeholder="Search" />