Skip to content

Instantly share code, notes, and snippets.

View richcollins's full-sized avatar

Rich Collins richcollins

View GitHub Profile

Keybase proof

I hereby claim:

  • I am richcollins on github.
  • I am richcollins (https://keybase.io/richcollins) on keybase.
  • I have a public key whose fingerprint is E4E0 391C 936B CA6B 2B26 94F8 489E 14E6 1AE7 2F4B

To claim this, I am signing this object:

**I will paypal $200 to anyone that can solve this for me**
I'm trying to get an Android WebView to play a video inline. On iOS you can just use webkit-playsinline in your video tag. Not so on Android. I followed the examples provided in these 2 answers:
http://stackoverflow.com/questions/3815090/webview-and-html5-video
http://stackoverflow.com/questions/4989738/how-to-play-a-video-in-a-webview-with-android
Using these techniques I can get the video to play only on the second time that I start the WebViewActivity. It doesn't work the first time and it doesn't work again after the second time. _You have to run this on a device, video won't play back at all in the emulator._ You can download the Android project here:
Proto = {
protoFn: new Function,
clone: function()
{
Proto.protoFn.prototype = this;
var clone = new Proto.protoFn();
if (clone.init)
{
clone.init();
<a onclick="timer = setTimeout(function () {window.location='/foo'}, 1000);" onDblclick="window.clearTimeout(timer);" >foo</a>
@richcollins
richcollins / gist:361355
Created April 9, 2010 16:42
Objective-C vs. Io
//Objective-C
#import <Foundation/Foundation.h>
@interface Settings : NSObject {
NSString *email;
NSString *password;
NSString *server;
BOOL pushesMentions;
Query := Object clone do(
delegate ::= nil
execute := method(
if(delegate,
delegate executeQuery(self)
,
"Query execute" println
)
)
@implementation NSTask (Extras)
- (NSTaskResult *)result
{
NSPipe *stdoutPipe = [NSPipe pipe];
[self setStandardOutput:pipe];
NSFileHandle *stdoutFile = [stdoutPipe fileHandleForReading];
NSPipe *stderrPipe = [NSPipe pipe];
[self setStandardError:stderrPipe];
render(options = nil, extra_options = {}, &block) #:doc:
raise DoubleRenderError, "Can only render or redirect once per action" if performed?
validate_render_arguments(options, extra_options, block_given?)
if options.nil?
options = { :template => default_template, :layout => true }
elsif options == :update
options = extra_options.merge({ :update => true })
elsif options.is_a?(String) || options.is_a?(Symbol)
- (void)setupTexture
{
CGDataProviderRef provider = CGDataProviderCreateWithFilename([imagePath UTF8String]);
CGImageRef image = CGImageCreateWithPNGDataProvider(provider, NULL, true, kCGRenderingIntentDefault);
CGDataProviderRelease(provider);
size_t width = CGImageGetWidth(image);
size_t height = CGImageGetHeight(image);
realloc(textureData, width * height * 4);
CGContextRef textureContext = CGBitmapContextCreate(textureData, width, height, 8, width * 4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedLast);
>> t = Time.zone.now; a = Account.create(:last_result_at => t); a.reload.last_result_at == t
=> false
>> t
=> Fri, 24 Jul 2009 21:52:16 UTC +00:00
>> a.last_result_at
=> Fri, 24 Jul 2009 21:52:16 UTC +00:00