Skip to content

Instantly share code, notes, and snippets.

var MyApp = angular.module('MyApp');
MyApp.factory('msgBus', ['$rootScope', function($rootScope) {
var msgBus = {};
msgBus.emitMsg = function(msg, data) {
data = data || {};
$rootScope.$emit(msg, data);
};
msgBus.onMsg = function(msg, func, scope) {
var unbind = $rootScope.$on(msg, func);
if (scope) {
@maximvl
maximvl / heart-animation.red
Created January 9, 2017 11:52 — forked from DideC/heart-animation.red
Heart animation for Red (only). Now with a complete control panel to play with the animations parameters. Nice time eater ;-)
Red [
title: "Heart animation"
author: "Didier Cadieu"
notes: {
Traduction in Red/Rebol of Terebus Volodymyr javascript demo : http://codepen.io/tvolodimir/pen/wqKuJ
}
Needs: View
]
;*** Settings
@maximvl
maximvl / datatype-help.red
Created March 26, 2017 13:35 — forked from greggirwin/datatype-help.red
Small GUI experiment for showing datatype information.
Red []
form-all: func [blk][
forall blk [blk/1: form blk/1]
blk
]
types-of: function [value [typeset!]][
; typesets don't support reflection
third load mold value
@maximvl
maximvl / info.red
Created September 4, 2017 08:50 — forked from toomasv/info.red
To get info about any function
Red []
info: func ['fn /name /intro /args /refinements /locals /return /spec
/arg-num /arg-names /arg-types /ref-names /ref-types /ref-num /type
/local intr ars refs locs ret arg ref typ
][
intr: copy "" ars: make map! copy [] refs: make map! copy [] locs: copy [] ret: copy [] typ: ref-arg: ref-arg-type: none
if lit-word? fn [fn: to-word fn]
unless find [op! native! function! action!] type?/word get fn [
cause-error 'user 'message ["Only function types accepted!"]
]
Red [
Author: "Toomas Vooglaid"
Date: 25-9-2017
Description: {Experiments with L-System}
]
ctx: context [
scale: origin: length: len: angle: width: delta-width: times-length: delta-length: delta-angle: aliasing?: stack: commands: none
defaults: [
scale 2.0
origin 300x500