Skip to content

Instantly share code, notes, and snippets.

View louisbl's full-sized avatar

Louis Beltramo louisbl

View GitHub Profile
package com.onavo.android.common.ui;
import android.view.View;
import android.view.ViewGroup;
import java.util.LinkedList;
import java.util.List;
/**
* Based on http://stackoverflow.com/a/8831593/37020 by by Shlomi Schwartz
@louisbl
louisbl / GoogleCalendarUriIntentFilter.java
Last active May 21, 2018 13:21
Decode Google Calendar URI to event id
/*
**
** Copyright 2009, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
static public native void onFBEvent( String jsEvName , String javaArg1 , String javaArg2 );
static{
System.loadLibrary( "HypFacebook" );
}
private static GLSurfaceView _mSurface = (GLSurfaceView) GameActivity.getInstance().getCurrentFocus();
private void onFBEventWrapper( final String arg0, final String arg1, final String arg2 ) {
_mSurface.queueEvent(new Runnable() {
@Override
public void run() {
@louisbl
louisbl / query_string.js
Created June 28, 2013 14:12
Get query string in js
var QueryString = function () {
// This function is anonymous, is executed immediately and
// the return value is assigned to QueryString!
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
@louisbl
louisbl / .htaccess
Created June 20, 2013 14:43
Rewrite rule for silex/symfony
Options -MultiViews
RewriteEngine On
RewriteBase /website
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [QSA,L]
package ;
abstract JsonMap<T>({ }) from {} {
public function new() this = {};
public function exists(key:String) return Reflect.hasField(this, key);
public function get(key:String) return Reflect.field(this, key);
public function set(key:String, value:T) Reflect.setField(this, key, value);
public function keys():Array<String> return Reflect.fields(this);
public function remove(key:String) return Reflect.deleteField(this, key);
public function iterator():Iterator<T> {
@louisbl
louisbl / Stats.hx
Created February 25, 2013 13:28
NME port of Mr Doob Stats
/**
* stats.hx
* http://github.com/mrdoob/stats.as
*
* NME port by fermmm
* http://fermmm.wordpress.com/
*
* Released under MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
@louisbl
louisbl / Stats.hx
Last active December 14, 2015 04:39 — forked from profelis/Stats.hx
H3D engine Stats
/**
* stats.hx
* http://github.com/mrdoob/stats.as
*
* Released under MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* How to use:
*
* addChild( new Stats(engine) );
@louisbl
louisbl / robot.js
Created December 6, 2012 16:14
DumberOne
var Robot = function(robot) {
robot.ahead(100);
robot.clone();
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(50);
robot.rotateCannon(45);
};
@louisbl
louisbl / robot.js
Created December 6, 2012 16:11 — forked from f6p/robot.js
DumberZero
// helpers
function areEnemies(robot, sighted) {
var sightedIsChild = (robot.id == sighted.parentId);
var sightedIsParent = (robot.parentId == sighted.id);
return !(sightedIsChild || sightedIsParent);
};
function baseStep(robot) {