Skip to content

Instantly share code, notes, and snippets.

View buttflattery's full-sized avatar
🎯
Focusing

Coackroach buttflattery

🎯
Focusing
View GitHub Profile
@benrobertsonio
benrobertsonio / lazy-video-loader.js
Last active November 4, 2019 22:02
Lazy Loading Video Based on Connection Speed
class LazyVideoLoader {
constructor() {
this.videos = [].slice.call(document.querySelectorAll('.hero__bgvideo'));
// Abort when:
// - The browser does not support Promises.
// - There no videos.
// - If the user prefers reduced motion.
// - Device is mobile.
if (
@subfuzion
subfuzion / curl.md
Last active May 16, 2024 18:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

class E2ETestCase extends PHPUnit_Framework_TestCase
{
protected $driver;
public function setUp()
{
$this->driver = App_Factory_RemoteWebDriver::factory();
}
// more here.
@joyrexus
joyrexus / README.md
Last active May 3, 2024 10:41 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@SeanCannon
SeanCannon / array_flatten.php
Last active April 26, 2024 09:43
PHP array_flatten() function. Convert a multi-dimensional array into a single-dimensional array.
<?php
/**
* Convert a multi-dimensional array into a single-dimensional array.
* @author Sean Cannon, LitmusBox.com | seanc@litmusbox.com
* @param array $array The multi-dimensional array.
* @return array
*/
function array_flatten($array) {
if (!is_array($array)) {