Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Implementation of hook_drush_command().
*/
function MODULE_drush_command() {
$items = array();
$items['resync-content-taxonomy'] = array(
'description' => "Re-sync content_taxonomy from term_node",
);
return $items;
@briancavalier
briancavalier / simple-promise-retry.js
Created February 24, 2011 18:35
A few general patterns for retries using promises
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);
@jasonmelgoza
jasonmelgoza / drupal-dl.md
Created November 6, 2011 07:34
Develop your Drupal site on your local box.

$ drush dl drupal

$ mv drupal-7.x/ drupal

$ cd drupal

$ cp ~/Sites/drupal/sites/default/default.settings.php ~/Sites/drupal/sites/default/settings.php

$ chmod -R a+w ~/Sites/drupal/sites/default

@pascalduez
pascalduez / demo.module
Created December 24, 2011 15:02
Drupal 7 — Basic Ajax form submit (Ajax framework)
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@mrconnerton
mrconnerton / node_field_collection_save.php
Created March 13, 2012 21:28
How to programtically save a node with field collections
<?php
// Lets just pretend your content type is "Event" with machine name "event"
$node = new stdClass();
$node->type = 'event';
node_object_prepare($node);
$node->title = "My event title";
$node->language = LANGUAGE_NONE;
@NickTomlin
NickTomlin / programatic.php
Created October 10, 2012 21:24
Programatic node creation in Drupal 7
<?php
/* ==========================================================================
Bootstrap Drupal
========================================================================== */
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);