Skip to content

Instantly share code, notes, and snippets.

@clemos
clemos / bookmarklet.html
Created October 6, 2011 10:13
Embedr - a bookmarklet script to steal embeds from other sites
<a href="javascript:s=document.createElement('SCRIPT');s.type='text/javascript';s.src='https://raw.github.com/gist/1267050/c20d7312e80a152508fb04a91f09fae8248b138c/embedr.js?'+Math.random();document.getElementsByTagName('head')[0].appendChild(s);">Embedr</a>
<ul>
<li>Grab the link to your bookmarks bar up there</li>
<li>Click on 'Embedr' bookmark when you are on a page you want to get embeds from</li>
</ul>
@clemos
clemos / .htaccess
Created March 4, 2012 15:56
server side haXe auto-compilation scripts
RewriteEngine on
RewriteRule ^(.*)\.hx\.js compilejs.php?cl=$1 [QSA]
@clemos
clemos / MyWorkerScript.hx
Created November 16, 2012 10:19
Javascript Workers in Haxe
using WorkerScript;
class MyWorkerScript extends WorkerScript {
public override function onMessage(e){
trace("on message triggered");
postMessage("ola");
}
static function main(){
@clemos
clemos / HybridSwitch.hx
Last active December 16, 2015 13:39
Make haxe switch to accept both patterns and identifiers
import haxe.macro.Context;
import haxe.macro.Expr;
class HybridSwitch {
/*
this macro attempts to make switch / case work both
with the new pattern matching feature and with
simple switch variables
import js.npm.mongoose.Model;
import js.npm.mongoose.Schema;
import js.npm.Mongoose;
class TestMongoose {
public static function main(){
Mongoose._.connect( 'mongodb://localhost/test' , cast start );
}
@clemos
clemos / Dockerfile
Last active August 29, 2015 14:10 — forked from ybootin/Dockerfile
Docker file for Haxe2
FROM ubuntu:latest
MAINTAINER Yohan Boutin <yohan.boutin@teads.tv>
RUN apt-get update
RUN apt-get -y upgrade
ENV HAXE_LIBRARY_PATH /usr/bin/haxelib
ENV HAXEPATH /usr/bin/haxe
@clemos
clemos / Dockerfile
Last active March 16, 2018 08:36
Dockerfile for Scala play
FROM ubuntu:latest
MAINTAINER Ingensi labs <contact@ingensi.com>
RUN apt-get update
RUN apt-get -y upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server curl software-properties-common unzip
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive apt-add-repository -y ppa:webupd8team/java
@clemos
clemos / Test.hx
Created October 6, 2015 11:58
Haxe/PHP bits issue
import haxe.Int32;
class Test {
static function main() {
// taken from https://github.com/HaxeFoundation/haxe/blob/development/tests/unit/src/unit/issues/Issue3414.hx.disabled
var x = 200015;
trace((((x << 28)) >> 28));
trace(((x << 28) & 0xffffffff) >> 28);
var x32 : Int32 = 200015;
@clemos
clemos / app.js
Created January 13, 2017 17:07
test web file
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
var opts = {
type: window.PERSISTENT,
size: 1024*1024
};
function FileView(ul) {
var files = [];
@clemos
clemos / client.js
Last active November 7, 2021 00:29
quick and dirty nodejs webrtc server
var pc = new RTCPeerConnection();
var localVideo = document.getElementById('local');
var remoteVideo = document.getElementById('remote');
var isBroadcaster = document.location.hash.indexOf('broadcast') > -1;
var watcherId;
function broadcast(stream) {
localVideo.src = URL.createObjectURL(stream);
pc.addStream(stream);