Skip to content

Instantly share code, notes, and snippets.

@juzna
juzna / example.php
Created June 25, 2011 15:59
Lazy-loading for PHP
<?php
class Address {
public $street;
public $town;
}
class Customer {
public $id;
public $name;
@md2perpe
md2perpe / lazyload.php
Created June 27, 2011 18:55
Lazyloading in PHP
<?php
abstract class Loader
{
abstract public function load();
}
class PaymentLoader extends Loader
{
protected $id;
<?php
/**
* Plugin Name: Lazy Load
* Description: Lazy load images to improve page load times. Uses jQuery.sonar to only load an image when it's visible in the viewport.
* Version: 0.5
*
* Code by the WordPress.com VIP team, TechCrunch 2011 Redesign team, and Jake Goldman (10up LLC).
* Uses jQuery.sonar by Dave Artz (AOL): http://www.artzstudio.com/files/jquery-boston-2010/jquery.sonar/
*
* License: GPL2
@AlekVolsk
AlekVolsk / svg-viewer.php
Created February 10, 2019 09:19
SVG viewer
<?php
$list = [];
$err = '';
$path = filter_input( INPUT_GET, 'path');
if ( !$path )
{
$err = 'Path is empty';
@sabl0r
sabl0r / confirm.js
Created December 11, 2015 08:48 — forked from stefket/confirm.js
JavaScript confirm with magnific popup
var confirmDialog = function(message, headline, cb) {
var dialog = '<div class="dialog confirm mfp-with-anim">';
if (headline) {
dialog += '<h2>' + headline + '</h2>';
}
dialog += '<div class="content"><p>' + message + '</p></div>';
dialog += '<div class="actions">';
dialog += '<button type="button" class="btn btn-default btn-cancel">Abbrechen</button> ';
dialog += '<button type="button" class="btn btn-primary btn-submit">OK</button>';
dialog += '</div>';
{"lastUpload":"2021-03-27T09:34:06.214Z","extensionVersion":"v3.4.3"}
@nakulrathore
nakulrathore / twitter_heart_animation
Created June 19, 2017 13:58
Twitter heart Animation pure css
<head>
<style>
.heart {
width: 100px;
height: 100px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: url(https://raw.githubusercontent.com/nakulrathore/materialcolors/gh-pages/heart.png) no-repeat;
@hzbd
hzbd / haproxy.config
Created May 4, 2013 17:34
Sample HAProxy config with logging.
global
pidfile /var/run/haproxy.pid
log 127.0.0.1 local0 info
ulimit-n 65536
defaults
mode http
clitimeout 600000 # maximum inactivity time on the client side
srvtimeout 600000 # maximum inactivity time on the server side
@elalemanyo
elalemanyo / ampify_img.php
Last active August 27, 2021 12:33
Make img AMP-ready
<?php
/**
* Replace img tag with amp-img
*
* <amp-img src="[src]"
* width="[width]"
* height="[height]"
* layout="responsive"
* alt="[alt]">
* </amp-img>
@bombap
bombap / coin.sol
Created September 11, 2021 08:54
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract XXX is ERC20, Ownable {
uint256 private aSBlock;
uint256 private aEBlock;
uint256 private aCap;