Skip to content

Instantly share code, notes, and snippets.

@segovia94
segovia94 / photoswipe_markup.html
Last active August 25, 2015 19:55
Photoswipe slide creation by scraping markup
<ul class="gallery">
<li>
<a href="/images/slide-1.jpg" data-size="1920x1080">
<img src="/images/thumb-1.jpg" alt="img1">
</a>
</li>
<li>
<a href="/images/slide-2.jpg" data-size="1920x1080">
<img src="/images/thumb-2.jpg" alt="img2">
</a>
$white: #fff;
$spacing-unit: 1em;
.footer-nav {
color: $white;
&__title {
margin-bottom: $spacing-unit;
color: $white;
}
@segovia94
segovia94 / SassMeister-input-HTML.html
Created June 30, 2015 18:47
Generated by SassMeister.com.
<main>
<div class="detail">
<h2>Hey Johnnie!</h2>
<p>The untold legend</p>
</div>
<div class="detail2">test</div>
</main>
<section>
<h2>Mom said it all</h2>
//force IE to render in latest version or use Google chrome
$meta_edge = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'http-equiv' => 'X-UA-Compatible',
'content' => 'IE=edge,chrome=1',
)
);
@segovia94
segovia94 / gist:5ddd6df0d799e2e9f032
Last active August 29, 2015 14:15
Add ckeditor autosave plugin to drupal ckeditor module
<?php
// Create a "plugins" directory in the gs_wysiwyg module and add the ckeditor autosave plugin to it.
// Then add the following code into the gs_wysiwyg.module file
/**
* Implements hook_ckeditor_plugin().
*/
function gs_wysiwyg_ckeditor_plugin() {
$plugin_path = drupal_get_path('module', 'gs_wysiwyg') . '/plugins/';
@segovia94
segovia94 / Print Drupal Permissions
Created January 27, 2015 01:25
Get a list of Drupal permissions
<?php
// Print a list of all set permissions.
// You can then copy the output from the website source code and paste it into a php array.
$user_roles = user_roles();
$roles = user_role_permissions($user_roles);
foreach ($roles as $rid => $permissions) {
print "\n\n" . $user_roles[$rid] . "\n";
foreach ($permissions as $permission => $bool) {
print "'" . $permission . "',\n";
@segovia94
segovia94 / gist:ee46a6e4670337316483
Created October 6, 2014 18:00
Hide menu on off click
//http://css-tricks.com/dangers-stopping-event-propagation/
$(document).click(function(event) {
if (!$(event.target).closest('.menucontainer').length) {
// Hide the menus.
console.log('hide the menu');
}
});
@segovia94
segovia94 / SingularityGS-layout-output.css
Last active August 29, 2015 14:06
Basic 3 column layout with SingularityGS. Generated by SassMeister.com.
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
img, video {
max-width: 100%;
height: auto;
}
$("input").focus(function() {
$(this).parent().addClass("add-bg");
}).blur(function(){
$(this).parent().removeClass("add-bg");
});
<?php
// node/add/project-review/%nid
$nid = arg(3); //Gets the nid from the url
if ($nid) {
//get the project node
$node = node_load($nid);
//add the entity reference to the project of it does not already have one
if (empty($form['field_project_refence'][LANGUAGE_NONE][0]['target_id']['#default_value'])) {