Skip to content

Instantly share code, notes, and snippets.

View underhilllabs's full-sized avatar

Bart Lantz underhilllabs

View GitHub Profile
@underhilllabs
underhilllabs / webform-og.md
Last active August 29, 2015 13:56
Webform and OG notes

OG Set up

  1. Install OG
  2. enable og, og_ui, og access control
  3. Create an Organic group
  4. go to Admin >> OG field settings
  • bundle >> Node >> Group
    1. Fields: Group .. click ( Add Field )
    2. Fields: Group Visibility .. click (Add Field)
  1. go to Admin -> OG field settings
  • bundle >> Node >> Webform
@underhilllabs
underhilllabs / vim.textile
Last active August 29, 2015 13:57
vim favorites

Key bindings I use a lot

Paste register contents while in insert mode

C-r" Paste most recent selection at cursor while in insert mode

copy a function name with yw, then enter search with / and copy the yanked function name into search with C-r"

Undo/Redo

@underhilllabs
underhilllabs / fapi_cb.md
Created March 17, 2014 20:16
Build an array of checkboxes in drupal #drupal.

Build up array of elements

  $query = db_select("users_roles", "ur")
             // TODO: fix hardcoded variable 5 for supervisor role
             ->condition("rid", 5)
             ->fields("ur", array("uid"));
  $result = $query->execute();

 $results_arr = array();
@underhilllabs
underhilllabs / show-form-id.,php
Created March 18, 2014 22:34
Drupal, implements hook_form_alter to show form ID of form.
function dance_code_form_alter(&$form, &$form_state, $form_id) {
drupal_set_message("Form ID is : " . $form_id);
}
@underhilllabs
underhilllabs / drupal-table.php
Last active August 29, 2015 13:57
query db with a join, using db_select. #drupal
<?php
function dance_code_show_sessions() {
$rows = array();
$query = db_select('node', 'n');
$query->join('field_data_field_session_date', 'sd', 'n.nid = sd.entity_id');
$query->condition('n.type', 'fundamentals_session')
->condition('n.status', 1)
->fields('sd', array('field_session_date_value'))
->fields('n', array('title','nid'))
@underhilllabs
underhilllabs / move-dev-to-stage.md
Last active August 29, 2015 13:58
Shell script to move Dev file system over to the Test.

deploy-dev-to-test.sh

cd ~/dance-subdomains/
chmod -R 777 dance-test
rm -rf dance-test
cp -r dance-dev dance-test

inside sites, there are the following directories

@underhilllabs
underhilllabs / d7_images_in_posts.md
Last active August 29, 2015 14:00
Drupal 7 insert images into posts

Modules to download and install

insert

image_resize_filter

install

drush dl insert image_resize_filter

Cat Notes

cat name direwolf name favorite food
Seamus Nymeria Salmon
Bossy ShaggyDog Tuna
<?php
<h2>Recent Public Bookmarks</h2>
@foreach($user->latestBookmarks($user->id) as $b)
<a href="{{ $b->url }}">{{ $b->title }}</a> <br />
@endforeach
<p />
<hr />
<p />
@underhilllabs
underhilllabs / app.js
Last active August 29, 2015 14:04
Angular.js notes
(function() {
var app = angular.module('store', [ ] );
app.controller('ReviewController', function() {
this.review = {};
this.addReview = function(product) {
this.review.createOn = Date.now();
product.reviews.push(this.review);
this.review = {};
};