Skip to content

Instantly share code, notes, and snippets.

View gwixted's full-sized avatar

Greg Wixted gwixted

  • Front-End Developer at Straight North
  • Aurora, IL
View GitHub Profile
@gwixted
gwixted / gist:4039676
Created November 8, 2012 15:55 — forked from NickTomlin/Recipes.md
Terminal Cheatsheet

Note

This contains commands shamelessly stolen from many authors. I will try to list all of them at the end of the file, but if I've missed someone, let me know.

Legend

  • UC/Use Case : a practical/frequently used example of the command in action (I find it easier to add commands into my daily workflow if I have an example that uses them in something I often do)

The Prompt


Navigating / Manipulating Text (emacs style terminal) [3]

@gwixted
gwixted / gist:5455492
Created April 24, 2013 20:55
Drupal Taxonomy Children Selection Rule
$rst = db_query('SELECT tid FROM taxonomy_term_hierarchy WHERE parent = :tid', array(':tid'=>arg(2)));
$result = $rst->rowCount();
if($result > 0){
return true;
}
@gwixted
gwixted / Breadcrumb Separator
Created June 11, 2013 16:30
Add this to the template.php file to change the separator between breadcrumbs
//REPLACE BREADCRUMBS SEPARATOR ========================================
function sndev_breadcrumb($variables) {
$sep = ' / ';
if (count($variables['breadcrumb']) > 0) {
return implode($sep, $variables['breadcrumb']);
}
else {
return t("Home");
}
}
// PHONE VALIDATION ==================================
^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$
// EMAIL VALIDATION ================================
^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$
// URL =============================================
^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$
<a href="//www.youtube.com/embed/1hhW76BIwP4?width=640&height=380&iframe=true&autoplay=1" class="colorbox-load cboxElement"><img src="sites/default/files/front-vid-thumb-01.jpg"></a>
@gwixted
gwixted / Terms of Use - Drupal
Last active August 29, 2015 13:57
Terms of Use boilerplate with drupal variables
<?php
$site_name = variable_get('site_name');
?>
<p>
ATTENTION: PLEASE READ THIS STATEMENT CAREFULLY BEFORE USING <?php echo $site_name; ?> (THIS &quot;WEB SITE&quot;). YOUR USE OF THIS WEB SITE CONSTITUTES YOUR ACCEPTANCE OF THIS COPYRIGHT STATEMENT AND TERMS OF USE (COLLECTIVELY, &quot;TERMS OF USE&quot;). IF YOU DO NOT ACCEPT THESE TERMS OF USE, DO NOT USE THIS WEB SITE.
</p>
<p>
<?php echo $site_name; ?> reserves the right to modify these Terms of Use without notice and any modifications are effective when they are posted here. <?php echo $site_name; ?> may, at any time, in its discretion terminate your access to this Web site. Access to the Web site may be monitored by <?php echo $site_name; ?> If you are accessing this Web site as a representative of an organization, these Terms of Use bind both you inpidually and the organization and references to &quot;you&quot; and &quot;your&quot; shall be construed to apply to you inpidually and the organization.
@gwixted
gwixted / Privacy - Drupal
Last active August 29, 2015 13:57
Privacy Policy with Drupal variables
<?php
global $base_root;
$site_name = variable_get('site_name');
$site_url = $base_root;
?>
<p><?php echo $site_name; ?> recognizes that users may have concerns about privacy issues as they navigate the Internet. <?php echo $site_name; ?> is committed to providing users with a safe, secure environment in which to secure information. <?php echo $site_name; ?> will use reasonable efforts to ensure that the information you provide remains private, and is used only for the purposes stated below.</p>
<h4>Collected Information</h4>