Skip to content

Instantly share code, notes, and snippets.

View weyert's full-sized avatar
🏠
Reading about ancient history

Weyert de Boer weyert

🏠
Reading about ancient history
  • London, Curaçao
View GitHub Profile
package tests
{
import assets.MainButton_Symbol;
import assets.dialogs.HelpDialog_Symbol;
import ch.nothing.flare.display.screens.ScreenManager;
import ch.nothing.flare.events.ScreenEvent;
import ch.nothing.flare.ui.Button;
import ch.nothing.flare.ui.inExistingViewOf;
@weyert
weyert / xml test data
Created January 13, 2011 08:29
what's an easy way to prepare xml data for unit testing
var types: Array = [ "slide" ];
var myXML: XML = <schedules>
<schedule>
<item type="{types[0]}"><![CDATA[An example to be displayed.]]></item>
</schedule>
</schedules>;
@weyert
weyert / delegation.as
Created January 15, 2011 14:45
Mock class for iModuleDelegate
public class MockModuleDelegate implements IModuleDelegate {
public function getTranslation( name: String, defaultValue: String = "" ): String {
if ( name == "title" ) {
return "Moduel Title";
} else if ( name = "currency" ) {
return "EUR";
}
// more resource strings here
@weyert
weyert / netstream.as
Created January 20, 2011 18:52
NetStream code
public function loadVideo(): void {
// create the video related variables
_netConnection = new NetConnection();
_netConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_netConnection.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler);
_netConnection.connect( null );
}
/**
* Connect to the video stream
@weyert
weyert / human_readable.pho
Created January 22, 2011 13:16
Human readable timespans
define("SECOND", 1);
define("MINUTE", 60 * SECOND);
define("HOUR", 60 * MINUTE);
define("DAY", 24 * HOUR);
define("MONTH", 30 * DAY);
/**
* Returns the human readable timespan from now to a date/time
*/
function human_readable( $time ) {
$GLOBALS['TL_DCA']['tl_page']['list']['operations']['clearcomments'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_page']['clearcomments'],
'href' => 'act=clearcomments',
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();"',
'button_callback' => array('WikiContentAccess', 'showActionButton')
);
@weyert
weyert / gist:1099785
Created July 22, 2011 16:24
Animations
private function onViewsUpdate():void
{
for each ( var item: AnimatedNumberView in _numberViews )
{
if ( item.animating )
{
item.currentValue++;
if ( item.currentValue > 9 ) {
item.currentValue = 0;
}
@weyert
weyert / gist:1287611
Created October 14, 2011 16:33
Madness!
package sounds
{
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.SampleDataEvent;
import flash.media.Sound;
import flash.utils.ByteArray;
/**
* RandomlyPlaylist
@weyert
weyert / gist:3175993
Created July 25, 2012 12:46
Problem with ExtJS 4.1
Ext.ns('App');
Ext.Loader.setConfig({ enabled : true, disableCaching : true });
Ext.Loader.setPath('Sch', '');
Ext.require([
'Sch.panel.SchedulerGrid',
'Sch.plugin.Pan',
'Sch.plugin.SimpleEditor',
'Sch.plugin.Lines',
@weyert
weyert / Auth.js
Created March 13, 2017 19:28
Trails annotations
const Annotation = require('ecmas-annotations').Annotation
const _ = require('lodash')
/**
* @module Auth
* @description Auth annotation
*/
module.exports = class Auth extends Annotation {
constructor(data, filePath) {