Instantly share code, notes, and snippets.

View gist:bb1d1cca11238bd3d6a8a78500e3a6ce
/*
A very inefficient but with best browser support way would be to check if the
clientBoundingRect of the image is currently inside the viewport or not on every
scroll event, damn! it's costly!
*/
/*
Let's say the images in HTML are:
*/
<img data-src="someimage1.png" class="lazy-image">
View README.md
@fantasticJilove
fantasticJilove / click-outside.directive.ts
Last active Feb 21, 2019
ClickOutsideDirective click out side a div element in angular
View click-outside.directive.ts
import { Directive, Output, EventEmitter } from '@angular/core';
@Directive({
selector: '[clickOutside]',
host: {
"(click)": "trackEvent( $event )", // we can use instead => @HostListener('click', ['$event'])
"(document: click)": "compareEvent( $event )" // we can use instead => @HostListener('document:click', ['$event'])
}
})
export class ClickOutsideDirective {
View gist:12e4d3645b8a91404e0232cbb412282d
import { Component, OnInit, Input } from '@angular/core';
import { GeradorSenha } from './gerador-senha.model';
@Component({
selector: 'fil-gerador-senha',
templateUrl: './gerador-senha.component.html',
styleUrls: ['./gerador-senha.component.css']
})
export class GeradorSenhaComponent implements OnInit {
@AsifIqbal093
AsifIqbal093 / PY0101EN-4-2-WriteFile.ipynb
Created Feb 21, 2019
Created on Cognitive Class Labs
View PY0101EN-4-2-WriteFile.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samgan-khan
samgan-khan / SlugBehavior.php
Created Feb 21, 2019
Slug creating behavior CakePhp 3.x
View SlugBehavior.php
<?php
namespace App\Model\Behavior;
use Cake\Datasource\EntityInterface;
use Cake\Event\Event;
use Cake\ORM\Behavior;
use Cake\Utility\Inflector;
use Cake\ORM\Table;
/**
View parse.cs
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Linq;
using Microsoft.EntityFrameworkCore;
@seleniumgists
seleniumgists / file.html
Created Feb 21, 2019
generated automatically from #selenium on seleniumhq slack
View file.html
`driver.findElement(By.xpath("//div[5]/div[2]/ul/li[2]/a/span")).click();
@ngsctt
ngsctt / Booko bookmarklet.md
Created Feb 21, 2019
How to make a bookmarklet that finds the book in a product page on Booko.com.au
View Booko bookmarklet.md

Booko bookmarklet

Use the following regex to extract the ISBN from the current window.location:

/[0-9]{13}|[0-9]{10}/

The code for the full bookmarklet is:

View untrusted-lvl4-solution.js
/*******************
* multiplicity.js *
*******************
*
* Out of one cell and into another. They're not giving you
* very much to work with here, either. Ah, well.
*
* Level filenames can be hints, by the way. Have I
* mentioned that before?
*