Skip to content

Instantly share code, notes, and snippets.

@nikhan
nikhan / twitter.sh
Created January 1, 2016 04:45
twitter ffmpeg
ffmpeg -i test.mov -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
@inexorabletash
inexorabletash / @ Indexed DB URLs via Service Workers.md
Last active December 20, 2023 01:29
Indexed DB URLs via Service Workers

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
paulirish / what-forces-layout.md
Last active December 20, 2024 19:44
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
MarsVard / README
Last active November 3, 2022 19:19
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
<View
android:layout_width="fill_parent"
@robert-b-clarke
robert-b-clarke / gist:7872713
Last active December 30, 2015 19:09
Being invited to try "Circle - The local network" didn't just make me angry, it made me think about a lot other stuff.

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
gr2m / account_dreamcode.js
Last active May 7, 2022 08:22
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
// sign up
account.signUp('joe@example.com', 'secret');
// sign in
account.signIn('joe@example.com', 'secret');
// sign in via oauth
account.signInWith('twitter');
// sign out
@trey
trey / getbundles.md
Created May 18, 2012 02:32
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 http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/
$ osascript -e 'tell app "TextMate" to reload bundles'

Sources

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