Skip to content

Instantly share code, notes, and snippets.

@krisselden
krisselden / gist:1386232
Created November 22, 2011 17:11
prepare animation
require('TransformJS');
require('jquery-easing');
Y$.DialogTransitions = SC.Mixin.create({
easing: 'easeInOutQuint',
prepareForDialogAnimateIn: function() {
return this.$().animate({
translateY: "+=" + Y$.viewport.height
}, 0);
},
dialogAnimateIn: function() {
@krisselden
krisselden / gist:1473687
Created December 13, 2011 20:14
Ember ajax wrapper
App.ajax = (url, settings)->
deferred = $.Deferred()
settings.xhr = ->
xhr = $.ajaxSettings.xhr()
if 'onprogress' of xhr
context = this
xhr.onprogress = (e)->
Ember.run(deferred, deferred.notifyWith, context, [e.loaded/e.total])
xhr
jqXHR = $.ajax(url, settings)
@krisselden
krisselden / sync_test.js
Created February 29, 2012 19:40
Binding in prototype
testBoth("bindings should do the right thing when binding is in prototype", function(get, set) {
var obj, proto, a, b, selectionChanged;
Ember.run(function() {
obj = {
selection: null
};
selectionChanged = 0;
Ember.addObserver(obj, 'selection', function () {
Flame.DisclosureView = Flame.LabelView.extend({
classNames: ['flame-disclosure-view'],
buttonExpanded: Flame.image('disclosure_triangle_down.png'),
buttonCollapsed: Flame.image('disclosure_triangle_left.png'),
button: function () {
this.get('visibilityTarget') ? this.get('buttonExpanded') : this.get('buttonCollapsed');
}.property('visibilityTarget', 'buttonExpanded', 'buttonCollapsed'),
handlebars: '<img {{bindAttr src="button"}}> {{value}}',
action: function() {
var value = this.getPath('visibilityTarget');
@krisselden
krisselden / YappPhoneGapLocalURLProtocol.m
Created June 8, 2012 18:45
handle a specific http + domain as a local resource
#import "YappPhoneGapLocalURLProtocol.h"
#ifdef PHONEGAP_FRAMEWORK
#import <PhoneGap/PhoneGapDelegate.h>
#else
#import "PhoneGapDelegate.h"
#endif
@interface YappPhoneGapLocalURLProtocol () <NSURLConnectionDelegate, NSURLConnectionDataDelegate>
@property (nonatomic, retain) NSURLConnection *connection;
Ember.ArrayUtils.indexOf = function (obj) {
var args = Array.prototype.slice.call(arguments, 1);
return obj.indexOf ? obj.indexOf.apply(obj, args) : arrayIndexOf.apply(obj, args);
}
Ember.ArrayUtils.indexOf = function (obj, value, start) {
return obj.indexOf ? obj.indexOf.call(obj, value, start) : arrayIndexOf.call(obj, value, start);
}
//current standalone
Ember.get = function(obj, key) {
//... use obj
}
// standalone case
get = Ember.get;
get(obj, 'foo');
@krisselden
krisselden / ember-debug.js
Created July 3, 2012 06:16
Provides anonymous functions display names in Safari and Firefox
(function () {
function createDisplayNames(obj, path) {
var val, key;
if (typeof obj === 'string') {
path = obj;
obj = Ember.getPath(path);
}
for (key in obj) {
// skip contructor
if (key === 'contructor') continue;
@krisselden
krisselden / screenshot_viewport.json
Created November 29, 2012 17:00 — forked from blitline-dev/screenshot_viewport.json
screenshot with viewport
{
"application_id":"YOUR_APP_ID",
"src":"http://www.yapp.us/splash/0f3fca7a-1ab0-490a-b456-53ccadf2be0f",
"src_type":"screen_shot_url",
"src_data": { "viewport" : "640x920"},
"functions":[
{
"name":"no_op",
"save":{
"image_identifier":"external_sample_1",
InsightArticleView: Em.ContainerView.extend
tagName: 'article'
childViews: ['toolbar']
toolbar: Core.EditorToolbarView