Skip to content

Instantly share code, notes, and snippets.

@krisselden
krisselden / gist:1386232
Created Nov 22, 2011
prepare animation
View gist:1386232
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 Dec 13, 2011
Ember ajax wrapper
View gist:1473687
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 Feb 29, 2012
Binding in prototype
View sync_test.js
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 () {
View gist:2369329
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 Jun 8, 2012
handle a specific http + domain as a local resource
View YappPhoneGapLocalURLProtocol.m
#import "YappPhoneGapLocalURLProtocol.h"
#ifdef PHONEGAP_FRAMEWORK
#import <PhoneGap/PhoneGapDelegate.h>
#else
#import "PhoneGapDelegate.h"
#endif
@interface YappPhoneGapLocalURLProtocol () <NSURLConnectionDelegate, NSURLConnectionDataDelegate>
@property (nonatomic, retain) NSURLConnection *connection;
View gist:2900201
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);
}
View gist:2902620
//current standalone
Ember.get = function(obj, key) {
//... use obj
}
// standalone case
get = Ember.get;
get(obj, 'foo');
@krisselden
krisselden / ember-debug.js
Created Jul 3, 2012
Provides anonymous functions display names in Safari and Firefox
View ember-debug.js
(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;
View screenshot_viewport.json
{
"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",
View gist:4320710
InsightArticleView: Em.ContainerView.extend
tagName: 'article'
childViews: ['toolbar']
toolbar: Core.EditorToolbarView
You can’t perform that action at this time.