Skip to content

Instantly share code, notes, and snippets.

Timur Kheyfets tkheyfets

Block or report user

Report or block tkheyfets

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View head.py
def function_name (iterable):
if len(iterable) > 0:
return iterable[0]
else:
return None
View every.py
def function_name (iterable, f):
result = True
for x in iterable:
if not f(x):
result = False
break
return result
View any.py
def function_name (iterable, f):
result = False
for x in iterable:
if f(x):
result = True
break
return result
View reverse.py
def function_name (iterable):
return iterable[::-1]
View find.py
def function_name (iterable, f):
result = None
for x in iterable:
if f(x):
result = x
break
return result
View filter.py
def function_name (iterable, f):
for x in iterable:
if f(x): yield x
View map.py
def function_name (iterable, f):
for x in iterable:
yield f(x)
View clone.js
function clone(obj) { return Object.create(obj); }
View debounce.js
function debounce(fn, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) fn.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
View es6_remove.js
const remove = (index, array) =>
[...array.slice(0, index),
...array.slice(index + 1, array.length)];
You can’t perform that action at this time.