Skip to content

Instantly share code, notes, and snippets.

ffmpeg -i -vcodec libx264 -vf 'scale=640:trunc(ow/a/2)*2' -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -strict experimental -r 30 out.mp4
View @ Indexed DB URLs via Service

URLs into Indexed DB, via Service Workers

Let's say you're using Indexed DB for the offline data store for a catalog. One of the object stores contains product images. Wouldn't it be great if you could just have something like this in your catalog page?

<img src="indexeddb/database/store/id">
paulirish /
Last active Jul 27, 2021
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
MarsVard / README
Last active Mar 16, 2021
android drawable to imitate google cards.
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
robert-b-clarke / gist:7872713
Last active Dec 30, 2015
Being invited to try "Circle - The local network" didn't just make me angry, it made me think about a lot other stuff.
View gist:7872713

It's been 3 months since I launched the proof of concept for LampNote, my platform for sharing and discovering local information. During that time it's become apparent that in its present form the site is unlikely to achieve the kind of exponential growth that will result in it becoming “the next big thing”, though it has achieved some modest success reuniting missing cats with their owners.

Since LampNote went live I've come across several sites and mobile apps which endeavour to accomplish something similar. That doesn't usually bother me. “Tell my neighbours about X” and “what's happening at Y” are still problems that haven't really been solved using the internet. It's no surprise that other people are trying their own approach with varying degrees of funding, traction and quality. Something odd happened yesterday though. I was invited via a Facebook notification to join Circle “the local network”. As I researched Circle I was simultaneously appalled and amazed, for this was a prod

gr2m / account_dreamcode.js
Last active Oct 6, 2020
Imagine the typical backend tasks for user authentication would exist right in the browser. How would the code look like? This is what I came up with. Forks & comments much appreciated! #nobackend #dreamcode
View account_dreamcode.js
// sign up
account.signUp('', 'secret');
// sign in
account.signIn('', 'secret');
// sign in via oauth
// sign out
trey /
Created May 18, 2012
Installing GetBundles on a Fresh Copy of TextMate

Installing GetBundles on a Fresh Copy of TextMate

$ mkdir -p ~/Library/Application\ Support/TextMate/Bundles
$ cd !$
$ svn co
$ osascript -e 'tell app "TextMate" to reload bundles'


colbyr / gist:2155434
Created Mar 22, 2012
Install Tomcat 6 with Homebrew
View gist:2155434
cd /usr/local/Library/Formula
git checkout 9e18876 tomcat.rb
brew install tomcat
ChrisMcKee /
Created Nov 3, 2011
Loading Dialog Phonegap Plugin
package com.phonegap.plugins; /*or just use your own namespace*/
import org.json.JSONArray;
import android.util.Log;
import com.phonegap.DroidGap;
import com.phonegap.api.Plugin;
import com.phonegap.api.PluginResult;