Skip to content

Instantly share code, notes, and snippets.

@Quilted
Quilted / Custom Panel Pane
Created February 15, 2011 22:44
Custom Panel Pane: This is for user pages, replace 'user' with node and replace artist_profile with your module.
<?php
/**
* Implementation of specially named hook_ctools_content_types()
*/
function artist_profile_share_ctools_content_types() {
return array(
'single' => TRUE,
'title' => t('Custom Share Links'),
'icon' => 'icon_node.png',
@Quilted
Quilted / gist:989969
Created May 24, 2011 23:06
Delete untracked files (not excluded via .gitignore) from a git repo
rm $(git ls-files -o --exclude-standard)
@Quilted
Quilted / gist:1007032
Created June 3, 2011 19:45
CSS Sticky Footer for Zen
We couldn’t find that file to show.
@Quilted
Quilted / gist:1036188
Created June 20, 2011 18:15
List files that have been changed since a certain time
find ./ -mtime -3d
@Quilted
Quilted / no_context_content_type.inc
Created July 5, 2011 01:25
CTools custom content pane example
<?php
/**
* @file
* "No context" sample content type. It operates with no context at all. It would
* be basically the same as a 'custom content' block, but it's not even that
* sophisticated.
*
*/
@Quilted
Quilted / db update
Created July 8, 2011 22:57
D6: Update a single db value for all users based on a regex
$result = db_query("SELECT uid FROM {users}");
while ($row = db_fetch_object($result)) {
$user = user_load($row->uid);
$new_state_profile = preg_replace('/^(\S){2}\s/', '', $user->profile_state);
update_sql("UPDATE {profile_values} SET value = '$new_state_profile' WHERE uid = $user->uid AND fid = 6");
}
// Clear caches
@Quilted
Quilted / patch with git
Last active September 26, 2015 14:27
Patching with git
// Making a patch
// When patching core, cd to www. When patching a module, cd to the module directory.
$ git diff --relative > file.patch
// Applying a patch
// From the git root directory
$ git apply -v --directory www/sites path/to/file.patch
@Quilted
Quilted / gist:1340711
Created November 4, 2011 22:57
National CAPACD Social Networking Block
<ul class="social-media-buttons"><li><a href="http://facebook.com/capacd"><img alt="Like NationalCAPACD on Facebook" src="http://www.searac.org/sites/all/themes/searac/images/facebook.png" /></a></li><li><a href="http://twitter.com/#!/CAPACD"><img alt="Follow CAPACD on Twitter" src="http://www.searac.org/sites/all/themes/searac/images/twitter.png" /></a></li><li><a href="http://vimeo.com/user6427743"><img alt="Follow NationalCAPACD on Vimeo" src="http://esenkay.com/socialmedia/vimeo-32x32.png" /></a></li></ul>
@Quilted
Quilted / gist:1346548
Created November 7, 2011 23:35
National CAPACD Footer Block
<div class="col col-1">DC Office: National Coalition for Asian Pacific American Community Development<br />1628 16th Street, NW - 4th Floor, Washington DC 20009<br />t 202-223-2442 | f 202-223-4144</div><div class="col col-2">CA Office: National Coalition for Asian Pacific American Community Development<br />310 8th Street, Suite 303, Oakland, CA 94607<br />t 510-452-4800 | f 510-981-3840</div>
@Quilted
Quilted / README.md
Last active December 12, 2015 01:38
Drupal 7: Allowing anonymous users access to Media module's browser

Drupal 7: Allowing anonymous users access to Media module's browser

What's up with Media module defaults?

To give anonymous users media permissions, know that Media module's permissions don't work as you might expect:

  • Import media files from the local filesystem: this is not for the media widget. You don't need to turn this on.
  • Edit media: You need this to upload files via the media widget.
  • Add media from remote services: straightforward.

The Library tab is not protected by any permissions. It's always included with the media browser plugin (aka the media widget).