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 asynkFunction(){ | |
return $timeout(function meAsynk(){ | |
throw new Error('error in meAsynk'); | |
}, 1); | |
} | |
asynkFunction().catch(function (err) { | |
errorHandler(err); | |
}); |
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
[{"id":1,"name":"AB InBev"},{"id":11,"name":"Adventure"},{"id":21,"name":"Barnet"},{"id":31,"name":"Beavertown"},{"id":41,"name":"Belleville"},{"id":51,"name":"Botanist"},{"id":61,"name":"Brew by Numbers"},{"id":71,"name":"Brew Wharf"},{"id":81,"name":"Brockley"},{"id":91,"name":"Brodie's"},{"id":101,"name":"Brüpond"},{"id":111,"name":"By the Horns"},{"id":121,"name":"Camden Town"},{"id":131,"name":"Clarence \u0026 Fredericks"},{"id":141,"name":"Crate"},{"id":151,"name":"The Cronx"},{"id":161,"name":"Earl's"},{"id":171,"name":"East London"},{"id":181,"name":"Ellenberg's"},{"id":191,"name":"Five Points"},{"id":201,"name":"Fuller's"},{"id":211,"name":"Hackney"},{"id":221,"name":"Ha'penny"},{"id":231,"name":"A Head in a Hat/Florence"},{"id":241,"name":"Hoppy Collie"},{"id":251,"name":"Howling Hops"},{"id":261,"name":"The Kernel"},{"id":271,"name":"The Lamb"},{"id":281,"name":"Late Knights"},{"id":291,"name":"Little Brew"},{"id":301,"name":"London"},{"id":311,"name":"London Fields"},{"id":321,"name":"Meantime"},{ |
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
// Search. | |
var found = $filter('filter')($scope.suggestions, {uid: suggestion.uid}, true); | |
var found = $filter('getById')($scope.suggestions, fish_id); | |
// Find and delete. | |
$scope.suggestions.splice( $scope.suggestions.indexOf(suggestion), 1 ); | |
// Get half of items. | |
$scope.suggestions.slice(0, $scope.suggestions.length / 2); |
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
# Customize to your needs... | |
GEMS=$(brew --prefix ruby)/bin | |
LOCALS=/usr/local/bin:/usr/local/sbin | |
SYSTEM=/usr/bin:/bin:/usr/sbin:/sbin | |
export PATH=$LOCALS:$GEMS:$PATH |
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
/** | |
* Implementation of template preprocess for the view. | |
*/ | |
function template_preprocess_views_bootstrap_accordion_plugin_style(&$vars) { | |
$view = &$vars['view']; | |
$title_field = $vars['options']['title_field']; | |
// Get titles. | |
if (isset($view->field[$title_field])) { | |
foreach ($vars['view']->result as $key => $field) { |
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
// Call method. | |
var method = (success ? 'start' : 'stop'); | |
obj[method](); | |
// Concatenation. | |
['first', 'name'].join(' '); // = 'first name'; | |
['milk', 'coffee', 'suger'].join(', '); // = 'milk, coffee, suger' | |
// Value by default. | |
var name = myName || 'No name'; // Returns 'No name' when myName is null or undefined |
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
(1..100).select {|x| (1..x).select{|y|x%y==0}.size==2 } | |
=> [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] |
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 | |
/** | |
* Implements hook_entity_property_info_alter(). | |
*/ | |
function example_search_api_property_entity_property_info_alter(&$info) { | |
$info['node']['properties']['created_week_day'] = array( | |
'type' => 'text', | |
'label' => t('Week day of node creation'), | |
'sanitized' => TRUE, | |
'getter callback' => 'example_search_api_property_weekday_getter_callback', |
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 | |
/** | |
* Implements hook_search_api_solr_query_alter(). | |
*/ | |
function custom_api_search_api_solr_query_alter(array &$call_args, SearchApiQueryInterface &$query) { | |
$call_args['params']['fl'] = 'is_votes-sightsrank,' . $call_args['params']['fl'] ; | |
$call_args['params']['bf'] = "recip(rord(is_votes-sightsrank),1, 1000, 1000)"; | |
} |
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 | |
\Drupal::config('module_name.settings')->set('variable', 'hello'); | |
$variable = \Drupal::config('module_name.settings')->get('variable'); |