Skip to content

Instantly share code, notes, and snippets.

View mohamedrez's full-sized avatar
🎯
Focusing

Mohamed mohamedrez

🎯
Focusing
View GitHub Profile
@mohamedrez
mohamedrez / sample_multiline.yml
Created August 9, 2019 10:10 — forked from usmansaleem/sample_multiline.yml
multiline docker environment variable (via docker compose)
environment:
SERVER_NAME: "myserver.doma.in"
# Dummy key, cert
SSL_KEY: |-
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQD272jYrLm8Ph5QpMWFcWUO9Ua1EviykalP+tkMIg12yZ3GvezF
y8aayxdztB5vu68jqMeg6mOJlscWqFUhmAxj4mDknYenVzVX2CKzCgHlGninTKxY
61rXDaDZVpSZ+XIESJkaB0z9HHYtrSLr0coKmq4cT5TRptOnkpDlJxIRaQIDAQAB
AoGATcTYoGTFmiN2KK+8BWrRCQT2X9C5woNdb3LxKIEQ/HhC2HS4PRMQWW/c0vPH
IilZ30EoneUztAFochpRtWLNg4lJoLy04X/eNjEiC/imp0KSwWXmnuLhDcWcb0+M
@mohamedrez
mohamedrez / tutorial.md
Created July 19, 2018 09:31 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

@mohamedrez
mohamedrez / jQuery_dependent.js
Created September 21, 2016 13:40
jQuery: dependent filter
$('[data-depends-on]').each(function(){
var $this = $(this);
var depends_on = $this.data('depends-on');
$this.hide();
$('[for="'+ $this.attr('id') + '"]').hide();
$('#'+depends_on).on('change',function(event) {
var $this = $(this);
if($this.val()){
var $depends_on_element = $('[data-depends-on="'+ depends_on + '"]');
$depends_on_element.fadeIn();
@mohamedrez
mohamedrez / gist:b5d98dfb518b7cca9ca5
Created October 24, 2015 10:19
Drupal 7: tpl on module
/**
* Implements hook_theme().
*/
function mymodule_theme($existing, $type, $theme, $path) {
$theme = array();
$theme['node__blog_post'] = array(
'render element' => 'content',
'base hook' => 'node',
'template' => 'node--blog_post',
'path' => drupal_get_path('module', 'mymodule') . '/templates',
@mohamedrez
mohamedrez / Drupal 7 : db_or
Created September 28, 2015 14:23
Drupal 7 : db_or
$db_or = db_or();
$db_or->condition('fc.fid', '5' , '=');
$db_or->condition('fc.uid', $uid , '=');
$query->condition($db_or);
@mohamedrez
mohamedrez / gist:eaf0d4f7c3584e97df51
Created September 8, 2015 09:19
Drupal 7 adding variable to javascript
drupal_add_js(array('YOURMODULE' => array('testvar' => $testvar)), array('type' => 'setting'));
@mohamedrez
mohamedrez / drupal_7_custom.js
Created August 12, 2015 09:52
drupal 7 custom javascript js
/**
* @file
* main.js
*
* Provides general enhancements and js functionalities.
*/
var Drupal = Drupal || {};
(function ($,Drupal) {
Drupal.behaviors.exampleModule = {
@mohamedrez
mohamedrez / d7_admin_form.php
Created July 22, 2015 09:48
D7 Form administration form
/**
* Implements hook_form().
* Admin form stripe configuration
*/
function mymodule_configuration_form($form, &$form_state) {
$form['mymodule_mode'] = array(
'#type' => 'select',
'#title' => t('Mode'),
@mohamedrez
mohamedrez / mymodule.info
Last active August 29, 2015 14:08 — forked from juampynr/mymodule.info
Drupal views handler
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
@mohamedrez
mohamedrez / WP: Bulk update custom field using a sql query
Last active August 29, 2015 14:06
WP: Bulk update custom field using a sql query
<?php
$ids = $wpdb->get_results("SELECT id FROM wp_4_posts WHERE post_type = 'post' LIMIT 0 , 300");
foreach($ids as $id){
update_post_meta($id->id, 'post_country', 'ksa');
}