Skip to content

Instantly share code, notes, and snippets.

View mandrasch's full-sized avatar
🔍

Matthias Andrasch mandrasch

🔍
View GitHub Profile
@mandrasch
mandrasch / select.html
Created April 15, 2016 10:51
Creative Commons 3.0 Ports
<!-- https://creativecommons.org/choose/?lang=en# (select " Looking for earlier license versions, including ports? ") -->
<option value="" selected="selected">
International
</option>
<option value="ar">Argentina</option>
<option value="au">Australia</option>
<option value="at">Austria</option>
<option value="be">Belgium</option>
<option value="br">Brazil</option>
<option value="bg">Bulgaria</option>
@mandrasch
mandrasch / Video end event
Created October 16, 2015 15:02
html5_video_event_ended.js
/* beispiel für video <video id="testvideo">*/
/* event listener */
document.getElementById('testvideo').addEventListener('ended',zeigeDialog,false);
/* funktion, die ausgeführt wird, wenn video endet */
function zeigeDialog(e) {
/* hier dialog zeigen */
@mandrasch
mandrasch / passage.html
Created September 29, 2015 15:21
Twine2 Sugarcube2 Skip video in passage
<!-- video must be initialized in storyinit before, see: https://gist.github.com/programmieraffe/b0ae841d1961e038d87a -->
<a id="skip-video">Skip intro video</a><span id="next-step" style="display:none;">[[2025|Prelude]]</span><<html5playvideo "wasteland" 53>>
<<script>>
$( document ).ready(function() {
$("#story").hide().delay(3000).fadeIn(1500);
/* thank to http://stackoverflow.com/a/2880950/809939 */
document.getElementById('wasteland').addEventListener('ended',myHandler,false);
function myHandler(e) {
@mandrasch
mandrasch / story_javascript.js
Last active April 24, 2017 19:07
Twine2 Sugarcube2 Macros for HTML5 video and audio-files in local browser
/* I used this in my interactive video textadventure: http://matthias-andrasch.de/2015/ela-twine-textadventure-mit-html5-video
Right now it only works in local browser because of preloading issues in realtime with big video files (maybe you have an idea for improving the preload)
Videos will be in the background in fullsize.
Initialize video/audio in "StoryInit" passage (important!):
<<html5loadvideo "riot" "media/video/riot.mp4">>
Example usage in twine passage:
<<html5playvideo "riot">>
@mandrasch
mandrasch / story_javascript.js
Created September 29, 2015 15:15
Twine2 Sugarcube 2 Macro for mespeakJS and typedJS
/* include this in your story javascript (story-> edit story javascript)
I used this in my interactive video textadventure: http://matthias-andrasch.de/2015/ela-twine-textadventure-mit-html5-video
*/
/* chrome does not let this happen from disk unfortunately, only in firefox */
if(typeof meSpeak === 'undefined'){
$.getScript("mespeak/mespeak.full.js").fail(function(){
console.log('loading mespeak via ajax failed, trying it the old school way');
var js = document.createElement("script");
@mandrasch
mandrasch / loadlocale.js
Created April 13, 2014 21:00
Mendeley loadlocale.js german
var locale = {"en-US":"<?xml version=\"1.0\" encoding=\"utf-8\"?><locale xmlns=\"http://purl.org/net/xbiblio/csl\" version=\"1.0\" xml:lang=\"de-DE\"><info><rights license=\"http://creativecommons.org/licenses/by-sa/3.0/\">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights><updated>2012-07-04T23:31:02+00:00</updated></info><style-options punctuation-in-quote=\"false\"/> <date form=\"text\"> <date-part name=\"day\" form=\"ordinal\" suffix=\" \"/> <date-part name=\"month\" suffix=\" \"/> <date-part name=\"year\"/> </date> <date form=\"numeric\"> <date-part name=\"day\" form=\"numeric-leading-zeros\" suffix=\".\"/> <date-part name=\"month\" form=\"numeric-leading-zeros\" suffix=\".\"/> <date-part name=\"year\"/> </date> <terms> <term name=\"accessed\">zugegriffen</term> <term name=\"and\">und</term> <term name=\"and others\">und andere</term> <term name=\"anonymous\">ohne Autor</term> <term name=\"anonymous\" form=\"short\">o. A.</term>
@mandrasch
mandrasch / gist:5160385
Created March 14, 2013 10:44
nice urls for etherpadlite on apache
RewriteEngine On
RewriteRule /p/*$ http://yourpad.de/ [NC,L]
RewriteCond %{REQUEST_URI} !^/locales/
RewriteCond %{REQUEST_URI} !^/locales.json
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{REQUEST_URI} !^/p/
RewriteCond %{REQUEST_URI} !^/static/
RewriteCond %{REQUEST_URI} !^/pluginfw/
RewriteCond %{REQUEST_URI} !^/javascripts/
RewriteCond %{REQUEST_URI} !^/socket.io/
@mandrasch
mandrasch / controller.php
Created July 19, 2012 12:18
Image gallery
function view() {
$this->loadBlockInformation();
$ih = Loader::helper('image');
$images = $this->images; // they are loaded
if($this->activateRandom == true)
{
shuffle($images);
@mandrasch
mandrasch / directive.js
Created June 16, 2012 14:56
PagedownBootstrap for AngularJS (directive)
/*
*usage: <textarea ui:pagedown-bootstrap ng:model="box.content"></textarea>
*/
myApp.directive('uiPagedownBootstrap', function() {
var nextId = 0;
return {
require: 'ngModel',
replace:true,
template:'<div class="pagedown-bootstrap-editor"></div>',
@mandrasch
mandrasch / directive.js
Created April 26, 2012 10:55
JqueryFileUpload Directive (Beware quick & dirty!)
/* jqueryFileUpload-Plugin
https://github.com/blueimp/jQuery-File-Upload */
MYANGULARAPP.directive('myJqueryfileupload', function(){
return{
restrict:'E',
compile:function(el,attrs){
var compiler = this;
var elem = el;
// 2DO: serialize it from json?