This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| // Get the current domain name without any sub domains. | |
| var internalDomain = (function () { | |
| var domainParts = [], | |
| hostnameParts = location.hostname.split("."), | |
| i; | |
| if (hostnameParts.length == 1) { | |
| return location.hostname; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if (!empty($items) && !empty($items[0]) && !empty($items[0]['#markup'])): ?> | |
| <div class="<?php print $classes; ?>"<?php print $attributes; ?>> | |
| <?php if ($multiple): ?> | |
| <?php if (!$label_hidden && $label) : ?> | |
| <h3 class="field-label"<?php print $title_attributes; ?>><?php print $label ?></h3> | |
| <?php endif; ?> | |
| <ul class="field-items"> | |
| <?php foreach ($items as $item) : ?> | |
| <li class="field-item"><?php print render($item); ?></li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $breakpoint = time() - 3 * 30 * 24 * 60 * 60; | |
| $q = db_select('node'); | |
| $q->addField('node', 'nid'); | |
| $q->addField('node', 'vid'); | |
| $q->condition('comment', 2); | |
| $q->condition('type', 'article'); | |
| $q->condition('created', $breakpoint, '<'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function formatNumber(value) { | |
| var input = value.toString(), | |
| inputParts = input.split('.'), | |
| int = inputParts[0], | |
| decimals = inputParts.length > 1 ? '.' + inputParts[1] : '', | |
| output = []; | |
| while (int.length > 3) { | |
| output.unshift(int.substr(-3)); | |
| int = int.substr(0, int.length - 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| ... | |
| # Redirect all requests to SSL. We use this rather than config.force_ssl since | |
| # we want to use temporary rather than permanent redirects. | |
| if Rails.env.production? | |
| before_filter do |controller| | |
| controller.force_ssl_redirect({:status => :found}) # 302: Moved temporarily | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Track an event in Google Analytics (legacy or Universal). | |
| * | |
| * @param category | |
| * The event category, e.g. "Download". | |
| * @param action | |
| * The event action, e.g. "PDF". | |
| * @param label | |
| * The event label, e.g. "Myfile.pdf". | |
| * @param value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'formula' | |
| class Xhprof <Formula | |
| url 'https://github.com/facebook/xhprof.git' | |
| homepage 'http://mirror.facebook.net/facebook/xhprof/doc.html' | |
| version 'master' | |
| depends_on 'pcre' | |
| def install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Calculate a unique integer based on two integers (cantor pairing). | |
| */ | |
| function cantor_pair_calculate($x, $y) { | |
| return (($x + $y) * ($x + $y + 1)) / 2 + $y; | |
| } | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| # Use Swedish as default locale. | |
| config.i18n.default_locale = :sv | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function mymodule_init() { | |
| drupal_set_message('A test message.', 'status'); | |
| drupal_set_message(str_repeat('Another message. ', 10), 'status'); | |
| drupal_set_message('A test warning.', 'warning'); | |
| drupal_set_message('A test error!!!', 'error'); | |
| } |