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 odoo import models, fields, api | |
from json_field import JsonField | |
class Person(models.Model): | |
_name = 'example.person' | |
_description = 'Person with json details' | |
details = JsonField() # a json object represented as dict / list / python primitives |
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 Board { | |
/** | |
* @param {string[]} rows | |
*/ | |
constructor(rows) { | |
this.cells = new Array(9).fill(0).map(row => new Array(9).fill(0)); | |
this.fixedCells = new Array(9).fill(0).map(row => new Array(9).fill(false)); | |
if (rows) { | |
for (let row = 0; row < rows.length; row++) { |
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
'PS' | |
.split('') | |
.map(x => x.charCodeAt(0) - 'A'.charCodeAt(0) + 1) | |
.reduce((acc, v, i, arr) => acc + v * Math.pow('Z'.charCodeAt(0) - 'A'.charCodeAt(0) + 1, arr.length - i - 1), 0); | |
// A => 1 | |
// Z => 26 | |
// AA => 27 | |
// PS => 435 |
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
public int hashCode() { | |
#if (!$superHasHashCode && $fields.size()==1) | |
#if($fields[0].array) | |
return java.util.Arrays.hashCode($fields[0].accessor); | |
#else | |
return java.util.Objects.hashCode($fields[0].accessor); | |
#end | |
#else | |
return java.util.Objects.hash(## | |
#set($i = 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
#set ($checkParameterWithInstanceof = true) | |
#set($classInstanceName = $helper.getUniqueLocalVarName("other", $fields, $settings)) | |
#set($paramName = $helper.getUniqueLocalVarName("obj", $fields, $settings)) | |
#set($settings.generateFinalLocals = true) | |
public boolean equals(## | |
#if ($settings.generateFinalParameters) | |
final ## | |
#end | |
Object $paramName){ | |
if (this == $paramName) { |