Skip to content

Instantly share code, notes, and snippets.

View markmarijnissen's full-sized avatar

Mark Marijnissen markmarijnissen

View GitHub Profile
@markmarijnissen
markmarijnissen / mo-files-scan.php
Created November 16, 2012 09:35
Wordpress: Which mo-files are loaded?
/*
Plugin Name: Mo-Files
Description: Which Mo-Files are loaded?
*/
function translation_scan($mo_file,$domain) {
global $TRANSLATION_FILES;
$TRANSLATION_FILES .= "<tr><td>$domain</td><td>$mo_file</td></tr>";
return $mo_file;
}
add_filter( 'load_textdomain_mofile', 'translation_scan' , 11, 2 );
/*globals define*/
define(function(require) {
'use strict';
// import dependencies
var Engine = require('famous/core/Engine');
var Surface = require('famous/core/Surface');
var ScrollView = require('famous/views/ScrollView');
var ImageSurface = require('famous/surfaces/ImageSurface');
var StateModifier = require('famous/modifiers/StateModifier');
var RenderNode = require('famous/core/RenderNode');
@markmarijnissen
markmarijnissen / config.coffee
Created June 18, 2014 09:53
Brunch.io: Easier file definition
exports.config = require('./easy-config.coffee').config({
src:
input:
"lib": [
"libs/jquery.min.js"
# ..etc ...
]
"app": [
"src/app/main.js"
/^src\/app/
@markmarijnissen
markmarijnissen / SidepanelLayout.js
Last active August 29, 2015 14:02
Famo.us SidepanelLayout
var View = require('famous/core/View');
var Engine = require('famous/core/Engine');
var Modifier = require('famous/core/Modifier');
var Transform = require('famous/core/Transform');
var StateModifier = require('famous/modifiers/StateModifier');
var Easing = require('famous/transitions/Easing');
var Transitionable = require('famous/transitions/Transitionable');
var GenericSync = require('famous/inputs/GenericSync');
@markmarijnissen
markmarijnissen / 01_start.md
Last active August 29, 2015 14:03
Famo.us App Structure

Given the following goals:

  1. Famo.us should be framework agnostic and integrate with Firebase, AngularJS, Meteor and more.
  2. Famo.us is a rendering engine, so it should be easy to share and reuse custom rendering nodes in different context (app, web, with different frameworks).
  3. Famo.us components should be loosely coupled and have no external dependencies. Ideally, it can be contained in a single file.
  4. Code should scale well to big projects, for example by structering the app into small, testable self-containted modules.
  5. Apps should be easy to reskin, remix and reconfigure.

....and given the existing design decisions:

@markmarijnissen
markmarijnissen / AddVisibility.js
Created July 1, 2014 19:36
Famo.us: Add visibility to modifiers
var Modifier = require('famous/core/Modifier');
var StateModifier = require('famous/modifiers/StateModifier');
__original_modify = Modifier.prototype.modify;
Modifier.prototype.modify = function extended_modify(target) {
__original_modify.call(this,target);
// here is the hack: set target to NULL if it should not be visible!
if(this._visibleGetter) this.visible = this._visibleGetter();
var Transform = require('famous/core/Transform');
function ShowModifier(options) {
this.visible = !!options.visible;
this._output = {
transform: Transform.identity,
opacity: 1,
origin: null,
align: null,
size: null,
@markmarijnissen
markmarijnissen / ScrollviewGoto.js
Last active August 29, 2015 14:03
Famo.us: Adds goToFirst, goToLast and goToIndex methods to Scrollview
define(function(require,module,exports){
var Scrollview = require('famous/views/Scrollview');
var ViewSequence = require('famous/core/ViewSequence');
var VELOCITY = 0; // default: No animation (i.e. the item isn't given any "swipe"-velocity when moved)
/***********************************
* getIndex
************************************/
Scrollview.prototype.getIndex = function () {
return this._node.getIndex();
@markmarijnissen
markmarijnissen / createFamousBox.sh
Created July 17, 2014 13:15
Famo.us in one file (including css). Version 0.2.x
# set famous version here
VERSION=0.2
#
echo "// Famo.us in one file. Including CSS. Version $VERSION." > famousBox.js
# load all libraries
curl -s http://code.famo.us/lib/functionPrototypeBind.js >> famousBox.js
curl -s http://code.famo.us/lib/classList.js >> famousBox.js
curl -s http://code.famo.us/lib/requestAnimationFrame.js >> famousBox.js
// TapEvent
//
// Adds a "tap" event to all surfaces.
//
// Usage:
//
// require("TapEvent") // require TapEvent ONCE BEFORE calling surface.on!
// surface.on("tap", ... )
//
// When is the "tap" event fired?