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
| cities = [] #1081 california cities | |
| t = Benchmark.realtime do | |
| cities.each { |c| Geocoder.coordinates(" #{c}, ca") } | |
| end | |
| t | |
| ## esri 349.3133 | |
| ## bing 204.9491 |
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 MyCustomSerializerClass < ActiveModel::Serializer | |
| class << self | |
| # customize the associated object to the serializer | |
| def model_class | |
| SomeOtherClass | |
| end | |
| end | |
| 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
| r = /bobcat|sky track|framing|forklift|demolition|plumbing|drywall|concrete|RF & magnetic shielding|electrian|bossman|boss man|fencing|farm equipment|equipment|steel|a job|my job|ur job|working|building|adding onto|18 wheeler|nuclear|powerplant|equipment|work station|my work|motor|fitting|fittin|stainless steal|stainless steel|mechanic|pipe|pipe welding|7018|6010|boiler|tool box|toolbox|tool|grinder|underpaid|repair|Mike Rowe|Miller Electric Welding|manufacturing|metals|forestry & logging|commercial & industrial equipment|industrials|mining materials|tools equipment|trade school|clutch|cylinder|roof|day at the office|carpenter|driver|maintenanceweld|weldor|tig|mig|gmaw|line out|welder|welding|weldin|welding hood|weldin hood/i | |
| string = "my work station in nashville. over $20,000 of equipment sitting on that table" | |
| # =~ | |
| position_time = Benchmark.realtime do | |
| 1000.times do | |
| string =~ r | |
| end | |
| 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
| # app/helpers/application_helper.rb | |
| # Render a partial into a script tag so Angular | |
| # sticks it into $templateCache | |
| def load_ng_template(partial) | |
| content_tag :script, type: 'text/ng-template', id: "#{partial}.html" do | |
| render partial | |
| end | |
| 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
| { "helloWorld": true } |
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
| .config(function (RestangularProvider) { | |
| RestangularProvider.addResponseInterceptor(function (data, operation, what, url, response, deferred) { | |
| return humps.camelizeKeys(data); | |
| }); | |
| RestangularProvider.addRequestInterceptor(function (data, operation, what, url, response, deferred) { | |
| return humps.decamelizeKeys(data); | |
| }); | |
| }); |
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
| var Library = function (books) { | |
| var books = []; | |
| this.searchBooks = function (query) { | |
| // return books that match query | |
| } | |
| } | |
| var books = []; | |
| var library = new Library(books); |
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
| angular.module('example', []) | |
| .factory('libraryFactorySingleton', function () { | |
| var books = []; | |
| return { | |
| searchBooks: function (query) { | |
| // return books that match query | |
| } | |
| }; | |
| }) |
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
| angular.module('example', []) | |
| .service('libraryService', function () { | |
| var books = []; | |
| this.searchBooks = function () { | |
| // return books that match query | |
| } | |
| }); | |
| var library = libraryService; |
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
| angular.module('example', []) | |
| .controller('libraryController', function (Books) { | |
| var initialize = function () { | |
| $scope.books = Books | |
| } | |
| $scope.removeBook = function () { | |
| // accessible to scope | |
| } | |