Skip to content

Instantly share code, notes, and snippets.

Jérôme Gangneux jrmgx

Block or report user

Report or block jrmgx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View GVR-VRWebview-example.cs
public class AndroidWebview : MonoBehaviour {
[...]
bool isClickedDown = false;
[...]
void Update () {
// GVR 1.7: Get the pointer current raycast
RaycastResult result = GvrPointerInputModule.CurrentRaycastResult;
// If the raycast is not hiting our gameobject, quit
@jrmgx
jrmgx / AndroidWebview.cs
Last active Feb 22, 2018
Android VR Webview Texture for Unity (more information at: https://jerome.gangneux.net/projects/2017-02-android-vr-webview/)
View AndroidWebview.cs
using UnityEngine;
using UnityEngine.EventSystems;
using System;
using System.Collections;
using System.Runtime.InteropServices;
[RequireComponent(typeof(Renderer))]
public class AndroidWebview : MonoBehaviour, IPointerExitHandler, IPointerClickHandler, IBeginDragHandler, IDragHandler, IEndDragHandler {
View keep-ratio.js
// This will calculate height for any .keep-ratio-4-3 or .keep-ratio-16-9 elements
// to keep the 4/3 or 16/9 ratio aspect (width must be set, height will be calculated)
// Init with keepRatio.start();
// It needs jQuery because I'm a lazy one
var keepRatio = (function ($) {
function ration(event) {
$('.keep-ratio-4-3').each(function () {
$e = $(this);
$e.height($e.width() * 3/4);
});
View JrmgxWebView.java
package net.gangneux.dev.jrmgxlibview;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Surface;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
@jrmgx
jrmgx / ahowto.md
Last active Jun 28, 2017
Scripts to generate theses kind of images : https://www.flickr.com/photos/jrmgx/24309475732/
View ahowto.md

This will help you use the scripts

Step 1

You need to take a picture of the movie every second,
this can be done with ffmpeg

$ ffmpeg -i my_movie.mkv -vf fps=1 my_movie/img%06d.png
View interpolateHermiteFor.swift
extension UIBezierPath {
static func interpolateHermiteFor(points: [CGPoint], closed: Bool = false) -> UIBezierPath {
guard points.count >= 2 else {
return UIBezierPath()
}
if points.count == 2 {
let bezierPath = UIBezierPath()
bezierPath.moveToPoint(points[0])
@jrmgx
jrmgx / StringExtensionHTML.swift
Created Nov 2, 2015 — forked from mwaterfall/StringExtensionHTML.swift
Decoding HTML Entities in Swift
View StringExtensionHTML.swift
import Foundation
// Very slightly adapted from http://stackoverflow.com/a/30141700/106244
// 99.99% Credit to Martin R!
// Mapping from XML/HTML character entity reference to character
// From http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
private let characterEntities : [String: Character] = [
View keybase.md

Keybase proof

I hereby claim:

  • I am jrmgx on github.
  • I am jrmgx (https://keybase.io/jrmgx) on keybase.
  • I have a public key whose fingerprint is 5C80 B807 56AC 72CD FFFA CB44 576B B1BF 6A09 07D5

To claim this, I am signing this object:

@jrmgx
jrmgx / spotify.php
Last active Dec 27, 2015
Get the track name/artist from a Spotify playlist (or selection)This is only a dirty scrapping, old school style \o/
View spotify.php
<?php
// Select tracks you want, do a right click > copy HTTP link then past in $list
$list = 'http://open.spotify.com/track/4pYUJryOcMh59G1DYg6bBB
http://open.spotify.com/track/3gIYL6Y2VyWjmhUK9OP8CK
...';
$final = [];
foreach (explode("\n", $list) as $item) {
$content = file_get_contents(trim($item));
View create-vhost.sh
#!/bin/bash
APACHE_SITES="/etc/apache2/extra/httpd-vhosts.conf"
VERSION_APACHE="1"
HOSTS="/etc/hosts"
function usage
{
echo "Usage: $0 ProjectName DocumentRoot"
echo "This script MUST be started as root"
You can’t perform that action at this time.