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
package main | |
import ( | |
cryptorand "crypto/rand" | |
"math/rand" | |
"errors" | |
"sync" | |
"fmt" | |
"time" | |
) |
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
import itertools | |
import sys | |
def non_increasing_range(items, i, j, _c): | |
try: | |
d = _c[(i, j)] | |
return d | |
except KeyError: | |
pass |
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
package main | |
import "fmt" | |
type Grid []uint | |
func (g *Grid) NewGrid(width int, height int) { | |
for i:=0; i < height; i++ { | |
*g = append(*g, 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
# Let's combine some queries together! | |
GET /bank/account/_search | |
{ | |
"query": { | |
"bool": { | |
"must": [{ | |
"match": { | |
"address": "court" | |
} | |
}], |
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
# Let's start by checking how many documents we have in the collection | |
GET /bank/account/_count | |
# A simple search. The word "Michael" must be fully conatiend somewhere in the specified field. | |
# A score is given to each document retrieved | |
GET /bank/account/_search | |
{ | |
"query": { | |
"match": { | |
"address": "Temple Court" |
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
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py | |
index d8f7fe5..7a7c651 100644 | |
--- a/django/contrib/admin/checks.py | |
+++ b/django/contrib/admin/checks.py | |
@@ -560,9 +560,10 @@ class ModelAdminChecks(BaseModelAdminChecks): | |
id='admin.E105', | |
) | |
] | |
- elif not issubclass(inline.model, models.Model): | |
- return must_be('a Model', option='%s.model' % inline_label, |
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
import heapq | |
import itertools | |
def _insert(dic, c): | |
try: | |
return dic[c] | |
except KeyError: | |
dic[c] = {} | |
return dic[c] |
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
import random | |
import math | |
def random_number_generator(base, power, base_num): | |
if power == 1: | |
return base() | |
return int((base_num ** (power-1)) * base() + random_number_generator(base, power-1, base_num)) | |
def generate_given(rand_num, target_rand_range): | |
if target_rand_range < rand_num: |
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
import copy | |
import itertools | |
from collections import defaultdict | |
import numpy as np | |
def get_minigrid_for_coord(i, j): | |
h = i / 3 | |
w = j / 3 | |
return w, h |
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
import copy | |
import itertools | |
from collections import defaultdict | |
import numpy as np | |
def get_minigrid_for_coord(i, j): | |
h = i / 3 | |
w = j / 3 | |
return w, h |