Skip to content

Instantly share code, notes, and snippets.

View scor's full-sized avatar

Stephane Corlosquet scor

View GitHub Profile
@scor
scor / .htaccess
Created March 11, 2014 20:05
Drupal .htaccess for Drupal 7's files directory - SA-CORE-2013-003
# Turn off all options we don't need.
Options None
Options +FollowSymLinks
# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>
@scor
scor / install-drush7.sh
Last active December 30, 2015 14:39
Automatically install Drush 7 (only tested on Mac OS X)
#!/bin/bash
#
# Install Drush 7 from https://github.com/drush-ops/drush.git
# and creates a 'drush7' alias. Execute this from your terminal:
# bash <(curl -s https://gist.github.com/scor/7843568/raw/install-drush7.sh)
if [[ ! -e '~/tools/drush7' ]]; then
mkdir -p ~/tools
cd ~/tools
@scor
scor / gist:6572973
Created September 15, 2013 17:54
generate fields in Drupal 8
function generate_fields() {
$field_name = 'field_gen_';
$field_type = 'text';
$field_formatter = 'text_default';
$number = 100;
for ($i = 1; $i <= $number; ++$i) {
echo("creating field $i \n");
entity_create('field_entity', array(
'name' => $field_name . $i,
@scor
scor / gist:5374653
Created April 12, 2013 19:54
This content gets filtered on input by Drupal
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
<code>
*storage="username"
</code>
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
@scor
scor / gist:4595196
Last active December 11, 2015 11:38
RDFa Lite markup example describing an organization in HTML head element
<html vocab="http://schema.org/">
<head>
<meta resource="http://my-company.com/" typeof="Organization" />
<meta resource="http://my-company.com/" property="name" content="my company name" />
<meta resource="http://my-company.com/" property="telephone" content="0000-0000" />
<link about="http://my-company.com/" property="address" href="http://my-company.com/#address" />
<meta resource="http://my-company.com/#address" typeof="PostalAddress" />
<meta resource="http://my-company.com/#address" property="streetAddress" content="38 avenue de l'Opera" />
<meta resource="http://my-company.com/#address" property="postalCode" content="98052" />
<meta resource="http://my-company.com/#address" property="addressLocality" content="Seattle" />