Skip to content

Instantly share code, notes, and snippets.

@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@langemike
langemike / streamed.php
Last active December 28, 2022 08:06 — forked from m4tthumphrey/streamed.php
Laravel response macro for streamed responses with seeking support (with bug fixes & usage example)
<?php
Response::macro('streamed', function($type, $size, $name, $callback) {
$start = 0;
$length = $size;
$status = 200;
$headers = [
'Content-Type' => $type,
'Content-Length' => $size,
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@daggerhart
daggerhart / simple-json-api.php
Last active October 21, 2018 16:15
Simple Read-Only JSON API example for WordPress
<?php
/**
* Class Simple_Json_Api
*/
class Simple_Json_Api {
/**
* The top level argument for the endpoint.
* ex http://example.com/myjson/post/1
@wibron
wibron / FT2014_slides.md
Last active August 29, 2015 14:01 — forked from oszbart/FT2014_slides
Front Trends 2014 slides/resources

Day 1

Julian Cheal

Dancing with Robots

?

Tero Parviainen

Build Your Own AngularJS

@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active May 2, 2024 23:15
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
@7Ds7
7Ds7 / raspberrypi_archlinux.md
Last active October 10, 2015 19:27 — forked from Couto/raspberrypi_archlinux.md
Raspberry Pi with ArchLinux
@sivieri
sivieri / midiTheremin.cpp
Created August 31, 2011 15:09
Code for reading from two IR proximity sensors with Arduino and outputting their values as MIDI CC
/*
Copyright (c) 2011 Alessandro Sivieri <alessandro.sivieri@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License version 3 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh