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 YourDynamicModelSerializer < ActiveModel::Serializer | |
| attributes :_id, :name | |
| def _id | |
| object._id.to_s | |
| end | |
| def attributes | |
| fields = object.attributes |
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
| <div class="control labelMove bottomSpace4"> | |
| <select | |
| id="org_node" | |
| name="orgNode" | |
| class="chosen-select" | |
| chosen="treeDropOptions" | |
| required | |
| ng-model="indicator.org_node_id"> | |
| <option ng-repeat="opt in treeDropOptions" ng-value="opt.id"> | |
| {{Array(opt.lvl * 7).join(" ")}} {{opt.name}} |
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
| unit_types = [ | |
| { name: 'length' }, | |
| { name: 'area' }, | |
| { name: 'weight' }, | |
| { name: 'volume' } | |
| ].each do |tag_info| | |
| puts "Added #{UnitType.create(tag_info).inspect}" | |
| 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
| factory.CSVtoArray = function (text) { | |
| var re_valid = /^\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*(?:,\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*)*$/; | |
| var re_value = /(?!\s*$)\s*(?:'([^'\\]*(?:\\[\S\s][^'\\]*)*)'|"([^"\\]*(?:\\[\S\s][^"\\]*)*)"|([^,'"\s\\]*(?:\s+[^,'"\s\\]+)*))\s*(?:,|$)/g; | |
| // Return NULL if input string is not well formed CSV string. | |
| if (!re_valid.test(text)) return null; | |
| var a = []; // Initialize array to receive values. | |
| text.replace(re_value, // "Walk" the string using replace with callback. | |
| function(m0, m1, m2, m3) { | |
| // Remove backslash from \' in single quoted values. | |
| if (m1 !== undefined) a.push(m1.replace(/\\'/g, "'")); |
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
| TreeniApp.directive('chosen', function() { | |
| var linker = function(scope, element, attr) { | |
| // update the select when data is loaded | |
| scope.$watch(attr.chosen, function(oldVal, newVal) { | |
| element.trigger('chosen:updated'); | |
| }); | |
| // update the select when the model changes | |
| scope.$watch(attr.ngModel, function() { | |
| element.trigger('chosen:updated'); |
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).each do |num| | |
| result = 'Tit' if num % 3 == 0 | |
| if num % 5 == 0 | |
| result &&= result + 'ForTat' | |
| result ||= 'Tat' | |
| end | |
| result ||= num | |
| puts result | |
| end |
NewerOlder