Skip to content

Instantly share code, notes, and snippets.

@pauginer
pauginer / wiki-missing-lang-codes.dart
Last active July 15, 2022 10:06
Find missing lang codes on wiki
List<String> findUniqueCodes(List<String> a, List<String> b){
var result = <String>[];
var setA = <String>{};
setA.addAll(a);
var setB = <String>{};
setB.addAll(b);
//var common = setA.intersection(setB);
@pauginer
pauginer / hype-slides
Last active October 10, 2020 15:12
Add this to the header of a Hype document to be able to move through scenes by using the keyboard arrows which may be convenient for creating presentations with Hype.
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
// http://mikemurko.com/general/jquery-keycode-cheatsheet/
var speed = 0.8; //transition speed
var transition = "push"; //types of transition: instant, fade, swap, push
var nextKeys= [39, 40, 34];
var prevKeys= [37, 38, 33];
$(function(){
@pauginer
pauginer / hype-bootstrap
Last active August 29, 2015 14:05
Scripts to make Hype more RESTful by supporting the back button and linking to specific scenes using a URL hash parameter. The code assumes the file is exported as index.html
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
//To be included on a header script for Hype
function updateSceneFromHash(){
var hash = window.location.hash;
var sceneName=hash.replace('#','');
var hypeDocument = HYPE.documents['index'];
if(hash.length == 0){
sceneName = hypeDocument.sceneNames()[0];
@pauginer
pauginer / hype-back-button
Last active August 29, 2015 14:04
Scene transitions where updateState is called can be navigated back using the browser "back" button.
var hash = window.location.hash;
if(hash.length != 0){
window.location.hash="";
}
jQuery(document).ready(function($) {
if (window.history && window.history.pushState) {
$(window).on('popstate', function() {
var hash = window.location.hash;
var sceneName=hash.replace('#','');
//To be included on a header script for Hype
//Updates the scene when the hash changes (Does not update on initial hash value)
$(window).bind( 'hashchange', function(e) {
var hash = window.location.hash;
var sceneName=hash.replace('#','');
var hypeDocument = HYPE.documents['index']
hypeDocument.showSceneNamed(sceneName, hypeDocument.kSceneTransitionInstant);
});
@pauginer
pauginer / jumpToParameterScene.js
Last active January 1, 2016 07:29
Function for Hype that allows to indicate the initial scene using a hash parameter. For example: http://pauginer.github.io/prototypes/draft-space/draft-creation/index.html#home
//To be added as a Timeline "Run Javascript" action at the very first of the Main timeline (of the first scene).
function jumpToParameterScene(hypeDocument, element, event) {
var hash = window.location.hash;
var sceneName=hash.replace('#','');
hypeDocument.showSceneNamed(sceneName, hypeDocument.kSceneTransitionInstant);
}