Skip to content

Instantly share code, notes, and snippets.

View AlexandreBonaventure's full-sized avatar

Alexandre Bonaventure Geissmann AlexandreBonaventure

View GitHub Profile
hahah
import Eventbus from '../launcher/services/eventbus'
// This comes from https://developers.google.com/web/tools/workbox/guides/advanced-recipes
// It allows activating the new service worker right away on reload
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('/sbvr-service-worker.js')
.then(function (registration) {
// Track updates to the Service Worker.
if (!navigator.serviceWorker.controller) {
@AlexandreBonaventure
AlexandreBonaventure / namespace.js
Last active February 20, 2017 19:21
[vuex 1.0] utils
import { mapValues } from 'lodash4'
export function namespace(prefix, getters) {
return mapValues(getters, v =>
(state) => {
const subState = state[prefix]
return v(subState)
}
)
}
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class SetupPointerInterface : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public void OnPointerEnter(PointerEventData eventData)
{
Debug.Log("Pointer Enter");
}
function getSymbolInstanceForElement(hypeDocument, element, event) {
var symbolInstance = null;
var parentSymbolElement = element.parentNode;
while (symbolInstance == null && parentSymbolElement != null) {
symbolInstance = hypeDocument.getSymbolInstanceById(parentSymbolElement.id);
parentSymbolElement = parentSymbolElement.parentNode;
}
console.log(symbolInstance);
}
/**
* Generate a unique id
*/
export const generateId = (numbers = 7) => {
const uniqueKey = Math.random().toString(36).substr(2, (2 + numbers)) // should be unique because of the seed
return `_${uniqueKey}`
}
export const castToNumber = (string) => parseInt(string)
@AlexandreBonaventure
AlexandreBonaventure / swapper.vue
Last active April 11, 2016 20:57
Swapper.vue
<script type="text/babel">
import $ from 'jquery'
const tmpComponent = {
template: '<div><slot></div>',
}
module.exports = {
name: 'fader-tile',
props: {
duration: {
@AlexandreBonaventure
AlexandreBonaventure / hype-loader.vue
Created April 8, 2016 19:36
Hype loader component
<script>
let $ = require('jquery')
module.exports= {
props: {
src: {
required: true,
},
hypeDocument: {
twoWay: true