class JavaScriptParser(BaseParser):
... # some (exactly four) (useful?) methods
get_references_of_tag = get_forms = BaseParser._return_empty_list
get_comments = BaseParser._return_empty_list
get_meta_redir = get_meta_tags = get_emails = BaseParser._return_empty_list
Developer if forced (by himself probably) to overwrite all methods to prevent raise NotImplementedError
xD
@register.filter
def rangocinco(obj_id, limit):
if (obj_id+5) > limit:
if not (limit-4) == obj_id:
# print((limit-4), obj_id, flush=True)
return range((limit-4), (limit+1))
else:
# print('SI NO', flush=True)
return range((obj_id-2), (obj_id+3))
else:
# print('NO', flush=True)
if (obj_id-4) < 2:
# print('NO SI', flush=True)
return range(obj_id, (obj_id+5))
else:
# print('NO NO', flush=True)
return range((obj_id-4), (obj_id+1))
Fuck
def get_first_index_of_array(array):
"""
this function is very usefull for get first index of array
"""
return array[0]
assert get_first_index_of_array([1, 2, 3, 4, 5]) == 1
assert get_first_index_of_array([1, 2, 3, 4, 5]) != 2
assert get_first_index_of_array([1, 2, 3, 4, 5]) != 3
assert get_first_index_of_array([1, 2, 3, 4, 5]) != 4
assert get_first_index_of_array([1, 2, 3, 4, 5]) != 4
latest_tag = "0.0.0"
for tag in tags:
if tag.name.startswith( 'v' ):
if tag.name.replace('v','').replace('.','') > latest_tag.replace('.',''):
latest_tag = tag.name.replace('v','')
$(document).on('click', '.edit-item', function(event) {
let row_id = event.currentTarget.attributes['data-row'].value,
data = dataIndex[
dataIndex.findIndex(i => i.id === Number(row_id))
];
$('.modal-body div:nth-child(1) input').attr('value', data.name)
$('.modal-body div:nth-child(2) input').attr('value', data.category)
$('.modal-body div:nth-child(3) #basicSelect').val(data.status)
$('.modal-body div:nth-child(4) input').attr('value', data.price)
$('.modal-body div:nth-child(5) input').attr('value', data.bju.mass)
$('.modal-body div:nth-child(6) input').attr('value', data.bju.calories)
$('.modal-body div:nth-child(7) input').attr('value', data.bju.proteins)
$('.modal-body div:nth-child(8) input').attr('value', data.bju.fats)
$('.modal-body div:nth-child(9) input').attr('value', data.bju.carbohydrates)
}
)
def get_schema(self, schema: object) -> object:
"""Get the Schema class
"""
if isinstance(schema, str):
Schema = getattr(self.request["operation"], schema, None)
else:
Schema = schema
if Schema is None:
Schema = getattr(self, schema, None)
if Schema is None:
raise web.HTTPNotImplemented
return Schema
I don't even know what to say
fn second_word(s: &String) -> &str {
let bytes = s.as_bytes();
let mut k = 0;
let mut n =0;
for (i, &item) in bytes.iter().enumerate() {
if item == b' ' {
k = k + 1;
if k == 1 {
n = i;
}
else if k == 2 {
return &s[1+n..i];
}
}
}
&s[..]
}
the code looks like shit
$options.splice($options.indexOf('option7'), 1);
$options.splice($options.indexOf('option5'), 1);
$options.splice($options.indexOf('option4'), 1);
$options.splice($options.indexOf('option3'), 1);
$options.splice($options.indexOf('option2'), 1);
$options.splice($options.indexOf('option1'), 1);
const rola = (usr: IUserData) => {
let student = "student"
let edukator = "edukator"
let dziekanat = "dziekanat"
let admin = "admin"
if(usr.type===1){
return student
}
else if(usr.type===2){
return edukator
}
else if(usr.type===3){
return dziekanat
}
else if(usr.type===4){
return admin
}
}
# Weird list cleanup
product = "{0}".format(list(product))
product = re.sub(r"\), \(+", "], [", product)
product = re.sub(r"\(+", "[", product)
product = product.replace(")]", "]]").replace(")", "")
product = ast.literal_eval(product)
I don't know why I get this strange fomat for this array of objects... Ok let's do it fast: 1 - Convert array in string 2 - Clean up string 3 - Convert string in array
{!! Form::select('ticket_category', \App\Models\Term::whereHas('taxonomy', function($query) {
$query->where('slug', 'ticket_category');
})->whereIn('id', ['15', '16', '17', '18'])
->pluck('name','id'), old('ticket_category'), [
'id' => 'ticket_category',
'class' => 'form-control',
'placeholder' => 'Seleccione una categorÃa']
)
!!}
to do it in an array if you can put it in the database so that you still burn the position
if (!rtrId.isPresent()) {
...
} else if (identityId.isPresent() && rtrId.isPresent()) {
...
}
A treasured knife protects
GetTagValueAsInteger: function (plctag, tag) {
var value = emosWS.getTagValue(plctag, tag);
return GetAsInteger(value);
},
GetTagValueAsiNTEGER: function (plctag, tag) {
return GetTagValueAsInteger(plctag, tag);
},
GetTAgValueASInteger: function (plctag, tag) {
return GetTagValueAsInteger(plctag, tag);
},
GetTagValueAsinteger: function (plctag, tag) {
return GetTagValueAsInteger(plctag, tag);
},
getTagValueAsInteger: function (plctag, tag) {
return GetTagValueAsInteger(plctag, tag);
},
$inputData = file_get_contents($inputFileName);
$inputData = str_replace("[[","",$inputData);
$inputData = str_replace("]]","",$inputData);
$data = explode('],[', $inputData);
Version of json decode.
if (botCount < botCount)
this.reconnect();
}
My friend wrote this code recently