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
//two seperate arrays with some duplicate numbers | |
//use object to hold values from larger array as keys | |
//compare second/smaller array against object.keys from first/larger array | |
//add duplicates to new array and return new array | |
var ArrayDuplicateFinder = (function() { | |
//Private variable | |
var arrayHash = {}; |
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
To reset processed jobs: | |
Sidekiq.redis {|c| c.del('stat:processed') } | |
To reset failed jobs: | |
Sidekiq.redis {|c| c.del('stat:failed') } | |
To reset statistics: | |
Sidekiq::Stats.new.reset |
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
app.directive('editButton', [ function(){ | |
return { | |
restrict: 'EA', | |
replace : true, | |
scope : { | |
text : '@', | |
action : '&' | |
}, | |
template: '<button class="btn btn-xs btn-info" ng-click="action()"><i class="fa fa-edit"></i> {{text}}</button>' |
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
app.factory('geoData', ['$http', '$q', 'limitToFilter', function ($http, $q, limitToFilter) { | |
return { | |
get: function(inputValue) { | |
var url = "http://gd.geobytes.com/AutoCompleteCity?callback=JSON_CALLBACK &filter=US&q="; | |
//since $http.get returns a promise, | |
//and promise.then() also returns a promise | |
//that resolves to whatever value is returned in it's | |
//callback argument, we can return that. | |
return $http.jsonp(url + inputValue) | |
.then(function (result) { |
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
location = params[:query][:location] | |
radius = params[:query][:radius] | |
@items = Item.where({:'origin.coordinates' => { "$within" => { "$centerSphere" => [ location, (radius.fdiv(3959) )]}}}) | |
T controller | |
@t = Location.where({:'origin.coordinates' => {"$within" => {"$centerSphere" => [origin, (oradius.fdiv(3959))]}}, '$and' => [{:'destination.states'.in => [state]}, "$or" => {:'destination.coordinates' => {"$within" => {"$centerSphere" => [dest, (dradius.fdiv(3959))]}}}]}) |
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
<select ng-model='param' required ng-options='option.value as option.name for option in scope'> | |
<option></option> | |
</select> | |
<input ng-model="param" placeholder=""> | |
<button ng-click="yourFunction(params)"></button> | |
Bootstrap dropdown toggle prevent default event on checkbox input |