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
| Traceback (most recent call last): | |
| File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/http.py", line 539, in _handle_exception | |
| return super(JsonRequest, self)._handle_exception(exception) | |
| File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/http.py", line 576, in dispatch | |
| result = self._call_function(**self.params) | |
| File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/http.py", line 312, in _call_function | |
| return checked_call(self.db, *args, **kwargs) | |
| File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/service/model.py", line 113, in wrapper | |
| return f(dbname, *args, **kwargs) | |
| File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/http.py", line 309, in checked_call |
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 _super = module.Order; | |
| module.Order = module.Order.extend({ | |
| init_from_JSON: function(json) { | |
| _super.prototype.init_from_JSON.apply(this,arguments); | |
| this.note = json.note; | |
| }, | |
| export_as_JSON: function(){ | |
| var json = _super.prototype.export_as_JSON.apply(this,arguments); |
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 ModalWidget = { | |
| view: function(ctrl, opts) { | |
| return m(".modal", [ | |
| m(".modal-dialog", [ | |
| m(".modal-header", [ | |
| m("h2", opts.title)]), | |
| m(".modal-body", [m("input[type=text]", {placeholder: "http://", oninput: m.withAttr("value", opts.pastedUrl), value: opts.pastedUrl()}), | |
| !opts.validUrl() ? m(".valid-message", [m("em", "Hey, that's not a valid URL!")]) : null, | |
| ].concat(opts.body)), | |
| m("a.close[href=javascript:;]", {onclick: function(e) { |
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
| def find_valleys(arr): | |
| peaks = [] | |
| for i in xrange(0, len(arr)): | |
| if i == 0 and arr[i] > arr[i + 1]: | |
| peaks.append((i, arr[i])) | |
| elif i == (len(arr) - 1) and arr[i] > arr[i - 1]: | |
| peaks.append((i, arr[i])) | |
| elif arr[i] > arr[i - 1] and arr[i] > arr[i + 1]: | |
| peaks.append((i, arr[i])) |
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
| # Find two numbers in a sorted arr that sum to s | |
| def sum(arr, s): | |
| print arr | |
| p1, p2 = 0, len(arr) - 1 | |
| while p1 < p2: | |
| # print p1, p2 | |
| curr = arr[p1] + arr[p2] | |
| if curr == s: | |
| return arr[p1], arr[p2] |
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
| from sys import stdin, maxint | |
| class WaterCell: | |
| def __init__(self, id_tuple, value): | |
| self.isPartitioned = False | |
| self.id = id_tuple | |
| self.value = value | |
| self.next = None | |
| self.group = -1 |
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
| def maxdiff(numbers): | |
| if len(numbers) < 2 or len(numbers) == 0: | |
| return 0 | |
| curr_max = numbers[0] | |
| max_diff = 0 | |
| for x in numbers: | |
| curr_max = max(x, curr_max) | |
| max_diff = max(curr_max - x, max_diff) |
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
| def maxdiff(numbers): | |
| if len(numbers) < 2 or len(numbers) == 0: | |
| return 0 | |
| max, min, max_diff = maxdiff_core(numbers, 0, len(numbers) - 1) | |
| return max_diff | |
| def maxdiff_core(numbers, start, end): | |
| if end == start: | |
| return numbers[start], numbers[start], 0 |
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
| log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit |
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
| navigator.sayswho = (function(){ | |
| var ua = navigator.userAgent, tem, | |
| M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; | |
| if (/trident/i.test(M[1])) { | |
| tem = /\brv[ :]+(\d+)/g.exec(ua) || []; | |
| return 'IE '+ (tem[1] || ''); | |
| } | |
| if (M[1] === 'Chrome') { | |
| tem = ua.match(/\b(OPR|Edge)\/(\d+)/); | |
| if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera'); |