This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#^syntax detection | |
site 'http://community.opscode.com/api/v1' | |
cookbook 'apt' | |
cookbook 'build-essential' | |
cookbook 'git' | |
cookbook 'mysql' | |
cookbook 'postgresql' #:github => 'express42-cookbooks/postgresql' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '✩✩✩✩ Update modules ✩✩✩✩' | |
drush -y up | |
echo '✩✩✩✩ Reinstall Drupal ✩✩✩✩' | |
drush -y site-install standard --account-name=admin --account-pass=admin | |
echo 'Disable modules' | |
drush -y dis dashboard overlay toolbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains \Drupal\session_test\Controller\ExampleController. | |
*/ | |
namespace Drupal\example\Controller; | |
use Drupal\Core\ControllerInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DRUPAL_DIR='/Users/mrded/Sites/drupal8' | |
mysql -uroot -e'DROP DATABASE drupal8; CREATE DATABASE drupal8;' | |
touch ${DRUPAL_DIR}/sites/default/files/foo | |
sudo chmod -R 777 ${DRUPAL_DIR}/sites/default/files | |
rm -rf ${DRUPAL_DIR}/sites/default/files/* | |
#drush -y -r ${DRUPAL_DIR} site-install standard --account-name=admin --account-pass=admin --sites-subdir=default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wj_profile_photo_upload_form() { | |
$form = array(); | |
$instance = field_info_instance('profile2', 'field_photo', 'profile'); | |
$field = field_info_field('field_photo'); | |
$form['profile_field_photo'] = array( | |
'#type' => 'managed_file', | |
'#upload_location' => file_field_widget_uri($field, $instance), | |
'#upload_validators' => file_field_widget_upload_validators($field, $instance), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<!-- If you delete this meta tag, Half Life 3 will never be released. --> | |
<meta name="viewport" content="width=device-width"/> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<meta property="og:title" content="*|SUBJECT|*"> | |
<title>*|SUBJECT|*</title> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$html = "<html><body>...</body></html>"; | |
$css = "a {padding: 5px;}"; | |
$html = mimemail_compress::mimemail_compress($html, $css); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function upload_file($path) { | |
// This is a PHP function to get a string representation of the image file. | |
$image = file_get_contents($path); | |
// A stream wrapper path where you want this image to reside on your file system including the desired filename. | |
$destination = 'public://path/to/store/this/image/name.jpg'; | |
$file = file_save_data($image, $destination, FILE_EXISTS_REPLACE); | |
if (is_object($file)) { // if you get back a Drupal $file object, everything went as expected so make the status permenant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function static_cache($value = NULL) { | |
$_value = &drupal_static(__FUNCTION__, array()); | |
if (isset($value)) { | |
$_value = clone $value; | |
} | |
return $_value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
drupal_alter('foo', $x, $y); | |
/** | |
* Implements hook_foo_alter(). | |
*/ | |
function hook_foo_alter(&$x, &$y) {} |
OlderNewer