Skip to content

Instantly share code, notes, and snippets.

View nedSaf's full-sized avatar
👨‍💻
I may be slow to respond.

Nader Safadi nedSaf

👨‍💻
I may be slow to respond.
View GitHub Profile
@nedSaf
nedSaf / gist:43d8335c8a8b592f0c37
Created November 26, 2015 12:47
Allow different origins in restful/
<?php
if (!drupal_is_cli()) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Headers: Authorization, access-token, access_token');
}
@nedSaf
nedSaf / probo.config.sh
Created October 27, 2015 14:12
Probo config file.
#!/bin/bash
#########################################################################################
#
# Configuration used in the different scripts.
#
# Copy this file in the same directory, the filename of the copy should be "config.sh".
#
#########################################################################################
@nedSaf
nedSaf / probo.yaml
Created October 27, 2015 13:57
Probo CI
steps:
- name: Setup working directory
command: "drush fec --json-config='{\"settings_php.snippets\": []}' --local-environment=probo icenter 7 "
- name: Drop the old database
command: 'drush --root=/var/www/icenter/webroot sql-drop -y'
- name: Install grunt
command: "npm install -g grunt-cli"
- name: Install bower
command: "npm install -g bower"
- name: Install Sass and Compass for Grunt to work
@nedSaf
nedSaf / broadcast.js
Created August 6, 2015 15:05
angular $broadcast.
Create broadcast:
$rootScope.$broadcast('scanner-started');
Listen to event:
$scope.$on('scanner-started', function(event, args) {
// do what you want to do
});
@nedSaf
nedSaf / bootstrap-tabs.html
Last active August 29, 2015 14:26
Bootstrap tabs working.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/twitterbootstrap/js/bootstrap-tab.js"></script>
@nedSaf
nedSaf / pantheon-sync.sh
Created March 23, 2015 07:28
Sync pantheon
#!/bin/bash
PANTHEON_DIR="/Library/WebServer/Documents/repo"
rm -rf $PANTHEON_DIR/profiles/pipeline
cp -R pipeline $PANTHEON_DIR/profiles/pipeline
rsync -avz --exclude '1' pipeline $PANTHEON_DIR/profiles/
@nedSaf
nedSaf / module
Created February 26, 2015 12:39
Add display mode.
/**
* Implements hook_entity_info_alter().
*
* Add "Activity stream" view mode.
*/
function c4m_message_entity_info_alter(&$entity_info) {
$entity_info['message']['view modes']['activity_stream'] = array(
'label' => t('Activity stream'),
'custom settings' => TRUE,
);
@nedSaf
nedSaf / widget validation
Created January 1, 2015 13:40
widget validation
$element['target_id']['#element_validate'][] = 'c4m_og_vocab_validate';
@nedSaf
nedSaf / login.php
Created November 30, 2014 10:34
Login custom function for behat
/**
* Authenticates a user with password from configuration.
*
* @Given /^I am logged in as user "([^"]*)"$/
*/
public function iAmLoggedInAsUser($username) {
$this->user = new stdClass();
$this->user->name = $username;
$this->user->pass = $this->drupal_users[$username];
$this->login();
@nedSaf
nedSaf / gist:0af08a05cbcfa382799d
Last active August 29, 2015 14:10
Install PhantomJs
- sudo apt-get update
- sudo apt-get install build-essential chrpath libssl-dev libxft-dev
- sudo apt-get install libfreetype6 libfreetype6-dev
- sudo apt-get install libfontconfig1 libfontconfig1-dev
- export PHANTOM_JS="phantomjs-1.9.7-linux-x86_64"
- wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
- sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/
- sudo tar xvjf /usr/local/share/$PHANTOM_JS.tar.bz2
- sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
- sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs