Skip to content

Instantly share code, notes, and snippets.

@absent1706
absent1706 / animate-on-scroll.html
Last active December 13, 2017 14:18
Anomate on scroll. Clone of https://michalsnik.github.io/aos/ library
<style>
/* aos = animate on scroll */
/* ================== Fade ================== */
[class^='aos-fade'] {
opacity: 0;
transition: 1s;
}
[class^='aos-fade'].aos-animate {
opacity: 1;
@absent1706
absent1706 / diy-jquery-delegated-handling.html
Created October 6, 2017 12:53
DIY jQuery delegated events handling like $(document).on('click', '.child', handler)
<!DOCTYPE html>
<html>
<head>
<script>
/* Core function which does event delegation like jQuery http://www.qopy.me/MpAEDJZiQKutDbKGuOEdQA
* Writing
* addDelegatedEventListener(parent, eventName, childSelector, handler)
*
* Is absolutely equivalent to writing jQuery's code:
* $(parent).on(eventName, childSelector, handler)
@absent1706
absent1706 / ko-mapping.html
Last active October 5, 2017 14:10
Knockout mapping for filling observableArray with view models from AJAX request
<!DOCTYPE html>
<html>
<body>
<button data-bind="click: loadProducts">Load Products</button>
<ul data-bind="foreach: products">
<li>
<span data-bind="text: id"></span>
<span data-bind="text: name"></span>
</li>
@absent1706
absent1706 / Pagination.php
Last active May 31, 2017 22:51
PHP pagination class
<?php
class Pagination
{
public $page;
public $totalCount;
public $perPage;
public $hasNext;
public $hasPrev;
@absent1706
absent1706 / cells.less
Created May 24, 2017 09:35
LESS mkedia objects (.cell)
.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
absent1706 / 2-lines-ellipsis.html
Created May 23, 2017 11:51
css 2-line ellipsis with gradient example
<style>
.relative {
position: relative;
}
.absolute-rightbottom {
position: absolute;
right: 0;
bottom: 0;
}
/*
* If you have
* .oneline {
* overflow: hidden;
* white-space: nowrap;
* text-overflow: ellipsis
* }
*
* inside Bootstrap's .media-body, i.g.:
*
@absent1706
absent1706 / sticky-footer.less
Created May 17, 2017 08:40
sticky-footer.less
<?php
$the_folder = '.';
$zip_file_name = '1.zip';
$download_file= true;
//$delete_file_after_download= true; doesnt work!!
class FlxZipArchive extends ZipArchive {
@absent1706
absent1706 / ko-init-observable-array.js
Created April 27, 2017 12:25
ko init observable array
/* Variants of initialization */
/* 1 */
self.emails = ko.mapping.fromJS(emailArray);
/* 2 */
self.emails = ko.observableArray();
ko.mapping.fromJS(emailArray, undefined, self.emails);
/* 3 */