Skip to content

Instantly share code, notes, and snippets.

View louisbl's full-sized avatar

Louis Beltramo louisbl

View GitHub Profile
@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
*
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 / .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]
@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") {
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 / 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
**
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 / notification.java
Created October 15, 2014 12:58
Android notification
// Notifications
Intent resultIntent = new Intent(this, PlayListActivity.class);
PendingIntent resultPendingIntent =
PendingIntent.getActivity(this,
0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT
);
NotificationCompat.Builder notifBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(android.R.drawable.ic_dialog_alert)
@louisbl
louisbl / alert_dialog.java
Created October 16, 2014 08:18
Android Alert Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setNegativeButton("CANCEL", null);
TextView view = new TextView(this);
view.setText("A dialog");
@louisbl
louisbl / config.xml
Last active August 29, 2015 14:09
Version number in config.xml for phonegap build
<?xml version='1.0' encoding='utf-8'?>
<widget
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:gap = "http://phonegap.com/ns/1.0"
id="com.example.app"
version="1.2.3"
versionCode="705">
<gap:platform name="ios" />