Skip to content

Instantly share code, notes, and snippets.

View Samuell1's full-sized avatar
🖖

Samuel Samuell1

🖖
View GitHub Profile
@Samuell1
Samuell1 / debounce.js
Created June 2, 2017 17:50 — forked from beaucharman/debounce.js
An ES6 implementation of the debounce function. "Debouncing enforces that a function not be called again until a certain amount of time has passed without it being called. As in 'execute this function only if 100 milliseconds have passed without it being called.'" - CSS-Tricks (https://css-tricks.com/the-difference-between-throttling-and-debounc…
function debounce(callback, wait, context = this) {
let timeout = null
let callbackArgs = null
const later = () => callback.apply(context, callbackArgs)
return function() {
callbackArgs = arguments
clearTimeout(timeout)
timeout = setTimeout(later, wait)
@Samuell1
Samuell1 / app.js
Created November 24, 2016 12:17 — forked from jmdobry/app.js
js-data + js-data-firebase + js-data-localstorage
var fb = new DSFirebaseAdapter({
basePath: 'https://my-app.firebase.io'
});
var ls = new DSLocalStorageAdapter();
var store = new JSData.DS({
// try firebase first, otherwise try offline data
fallbackAdapters: ['fb', 'ls'],
// After creating an item, sync it to localStorage
@Samuell1
Samuell1 / status.php
Last active August 29, 2015 14:14 — forked from dkesberg/status.php
<?php
/**
* @author Daniel Kesberg <[email protected]>
* @copyright (c) 2013, Daniel Kesberg
*/
error_reporting(E_ALL);
ini_set('display_errors', false);
$parseTimeStart = microtime();
<?php
/**
* File: SimpleImage.php
* Author: Simon Jarvis
* Modified by: Miguel Fermín
* Based in: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
/**
* source: http://stackoverflow.com/questions/3203354/php-script-to-render-a-single-transparent-pixel-png-or-gif
*/
// transparent 1x1 png
header('Content-Type: image/png');
echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=');
// transparent 1x1 gif
header('Content-Type: image/gif');