Skip to content

Instantly share code, notes, and snippets.

Alexander absent1706

Block or report user

Report or block absent1706

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
def dict_without_keys(data_: dict, keys: list):
from dictdiffer import diff
assert list(diff(
dict_without_keys(listing.to_dict(), ['_id', '_cls', 'created_date', 'updated_date', 'rooms[].id', 'photos']),
dict_without_keys(normal_listing_dict, ['photos'])
# this method works well on ALL data
# see
import numpy as np
from sklearn import preprocessing
X = np.array([
def visualize_grid_cv_params(grid_cv):
df = pd.DataFrame(grid_cv.cv_results_['params'])
df['score'] = grid_cv.cv_results_['mean_test_score']
fig, axes = plt.subplots(1, len(grid_cv.param_grid), sharey=True, figsize=(15,4))
i = 0
for param in grid_cv.param_grid:
data = df.groupby(param).mean()['score'].to_dict()
param_values = list(data.keys())
View animate-on-scroll.html
/* aos = animate on scroll */
/* ================== Fade ================== */
[class^='aos-fade'] {
opacity: 0;
transition: 1s;
[class^='aos-fade'].aos-animate {
opacity: 1;
absent1706 / diy-jquery-delegated-handling.html
Created Oct 6, 2017
DIY jQuery delegated events handling like $(document).on('click', '.child', handler)
View diy-jquery-delegated-handling.html
<!DOCTYPE html>
/* Core function which does event delegation like jQuery
* Writing
* addDelegatedEventListener(parent, eventName, childSelector, handler)
* Is absolutely equivalent to writing jQuery's code:
* $(parent).on(eventName, childSelector, handler)
absent1706 / ko-mapping.html
Last active Oct 5, 2017
Knockout mapping for filling observableArray with view models from AJAX request
View ko-mapping.html
<!DOCTYPE html>
<button data-bind="click: loadProducts">Load Products</button>
<ul data-bind="foreach: products">
<span data-bind="text: id"></span>
<span data-bind="text: name"></span>
absent1706 / Pagination.php
Last active May 31, 2017
PHP pagination class
View Pagination.php
class Pagination
public $page;
public $totalCount;
public $perPage;
public $hasNext;
public $hasPrev;
absent1706 / cells.less
Created May 24, 2017
LESS mkedia objects (.cell)
View cells.less
.fulltable {
display: table;
width: 100%;
/* See bootstrap's media.less for code that inspired this one*/
& {
@_padding: 10px;
@_padding-thin: 5px;
@_padding-thick: 20px;
absent1706 / 2-lines-ellipsis.html
Created May 23, 2017
css 2-line ellipsis with gradient example
View 2-lines-ellipsis.html
.relative {
position: relative;
.absolute-rightbottom {
position: absolute;
right: 0;
bottom: 0;
View mediabody-oneline-fix.less
* If you have
* .oneline {
* overflow: hidden;
* white-space: nowrap;
* text-overflow: ellipsis
* }
* inside Bootstrap's .media-body, i.g.:
You can’t perform that action at this time.