Skip to content

Instantly share code, notes, and snippets.

View atebitftw's full-sized avatar
💭
I may be slow to respond.

AteBit atebitftw

💭
I may be slow to respond.
View GitHub Profile
@atebitftw
atebitftw / designer.html
Created August 29, 2014 21:01
designer
<link rel="import" href="../cool-clock/cool-clock.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@atebitftw
atebitftw / buckshot_template_resource
Created December 18, 2012 22:19
Example Buckshot's declarative keyframe animation to CSS3 translation.
<template xmlns='http://buckshotui.org/platforms/html'>
<border name='box1' width='50' height='50' background='Blue'>
<actions>
<!-- declaratively specifying a trigger to play the animation -->
<playanimation event='click' animation='anim1' />
</actions>
</border>
<resourcecollection>
<animationresource key='anim1'>
<keyframes>
@atebitftw
atebitftw / gist:4137606
Created November 23, 2012 22:41
Buckshot template on SVG Platform
<!-- notice the xmlns declaration for the '/svg' namespace -->
<template xmlns='http://buckshotui.org/platforms/svg'>
<!-- ... which brings all the SVG platform elements into scope -->
<group>
<rect x='10' y='10' width='100' height='50' fill='Blue' stroke='Black' strokewidth='3' />
<ellipse opacity='.75' cx='75' cy='75' rx='50' ry='100' fill='Orange' stroke='Black' strokewidth='5' />
</group>
</template>
@atebitftw
atebitftw / gist:4137566
Created November 23, 2012 22:24
Using namespaces in deferred template scenarios.
<!-- here is what an CollectionPresenter might look like before namespaces -->
<stack>
<textblock text='Here is that list of fruit you ordered.' />
<collectionpresenter collection='{data fruit}'>
<itemstemplate>
<textblock text='{data}' fontsize='20' foreground='Green' />
</itemstemplate>
</collectionpresenter>
</stack>
@atebitftw
atebitftw / gist:4137537
Created November 23, 2012 22:15
Declaring a custom namespace extension for Buckshot Templates
<!--
In addition to the default namespace, we add another named namespace
which declares that anything prefixed with 'custom' should be part of
that namespace scope.
-->
<template xmlns='http://buckshotui.org/platforms/html'
xmlns:custom='http://buckshotui.org/sprockets'>
<!-- elements in the default namespace work just fine. -->
<stack>
<textblock text='Here is that sprocket that you ordered:' />
@atebitftw
atebitftw / gist:4137502
Created November 23, 2012 22:05
Simple namespace usage in Buckshot template
<!--
We declare a defult namespace which tells the framework
which platform elements are in-scope by default.
-->
<template xmlns='http://buckshotui.org/platforms/html'>
<!--
without the above namespace declaration, this element
will not be found by the template parser
-->
<textblock text='hello world' />
@atebitftw
atebitftw / gist:3808465
Created September 30, 2012 21:14
Custom Vector3 Control for Buckshot
class Vector3 extends Control
{
FrameworkProperty xProperty;
FrameworkProperty yProperty;
FrameworkProperty zProperty;
final FrameworkEvent<VectorChangedEventArgs> changed =
new FrameworkEvent<VectorChangedEventArgs>();
@atebitftw
atebitftw / gist:3671914
Created September 8, 2012 04:52
Setting up Buckshot app for full browser
// In CSS: body{margin:0px;padding:0px}
// given this main template (would be in your HTML file typically)
String t =
'''
<dockpanel halign='stretch' valign='stretch'>
<!-- menu strips (in other templates) will bind to this border -->
<border dockpanel.dock='top' content='{data menuStripContent}'></border>
<!-- controls will bind to this border -->
@atebitftw
atebitftw / gist:2854180
Created June 1, 2012 18:24
Code Golf - Rick Roll
void main(){var c="DEF>G~DEH>I~DEJK)L>~DEB>M~DENO~DE=PQ)R>~~";var d="STU9V*W~XYZ[\\~]^_#N`~abc&dZef~g&'h)iEj`~";var e="~DEvDEF~x>t~";var o='';' !"#\$~%&\'()*+,~-./0123~%456789:~,;<=>?1@~AB>C~~$c${d}kl>mn?1@~o=np^q#r~~$c${c}sF>t~sF>t~u${e}u$e~$d~,;<=>?1@~AB>C~~$c$c$c'.charCodes().forEach((i)=>o+=i==126?'\n':'${"We're no strangers to love You know the rules and so do I A full commitment's what I'm thinking of wouldn't get this from any other guy just wanna tell you how feeling Gotta make understand Never gonna give up let down run around desert cry say goodbye a lie hurt We've known each for long Your heart's been aching but You're too shy it Inside we both what's going on We game we're play And if ask me Don't you're blind see (Ooh, up) (Ooh) give, never (Give".split(' ')[i-32]} ');print(o);}
@atebitftw
atebitftw / Dart_Singleton_Maybe
Created April 26, 2012 20:54
Dart Singleton?
class MyClass{
static MyClass _ref;
static MyClass get context() => _ref == null ? new MyClass() : _ref;
factory MyClass(){
if (_ref != null) return _ref;
_ref = new MyClass._internal();