Skip to content

Instantly share code, notes, and snippets.

View AmilKey's full-sized avatar
🏠
Working from home

DekkoSecure 2 AmilKey

🏠
Working from home
View GitHub Profile
@AmilKey
AmilKey / gist:e14710601dc1757e78a0
Created October 7, 2015 14:14
Ember forEach aaray
https://github.com/emberjs/data/issues/772
I think there is a kind of Conccurent modification, you're walking through the list
and delete one element at the same time. I think the run.once defers the deletion after the loop has been made.
To avoid it, I think you could iterate over a copy instead of the content. Something like
@get("content").toArray().forEach(article) ->
article.deleteRecord()
forEach uses Array.prototype.forEach which is basically:
@AmilKey
AmilKey / gist:4aaf31b0ee7e4d9f39d0
Created September 29, 2015 16:48
ember 2.0 forms
amilkey [7:35 PM]
@ everyone what you use for forms?
i looked at ember addons that work with Ember 2.0 and didn't find anything
pixelhandler [7:36 PM]
@amilkey: I use a component for the form and have status for editing and previewing and sometimes use the buffered proxy addon to delay changes to the model
pixelhandler [7:39 PM]
and use a flag for new too, when previewing I make the inputs disabled
@AmilKey
AmilKey / gist:c89daed271ed46ddd1be
Created September 23, 2015 13:50
мердж отдельных файлов из ветки
http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/
$ git branch
* master
twitter_integration
$ git checkout twitter_integration app/models/avatar.rb db/migrate/20090223104419_create_avatars.rb test/unit/models/avatar_test.rb test/functional/models/avatar_test.rb
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
@AmilKey
AmilKey / gist:034a2bdb9fea30e51543
Created September 17, 2015 10:10
states of ember.js model
http://emberjs.com/api/data/classes/DS.RootState.html
* root
* deleted
* saved
* uncommitted
* inFlight
* empty
* loaded
* created
// from https://www.youtube.com/watch?v=vvZEddrClAQ&feature=youtu.be
export default Ember.Component.extend({
draw(){
if (this._state !== 'inDOM') return;
let data = this.get('data');
// do d3 stuff
},
@AmilKey
AmilKey / gist:c442df6f5d7499a41bdb
Last active August 30, 2015 08:05 — forked from bortevik/gist:c9310ab768e9baa5335a
LocalStorage wraper
App.StorageService = Ember.Object.extend({
persistence: window.localStorage,
namespace: 'ember-storage-service',
init: function() {
var callback = this._handleStorageEvent.bind(this);
$(window).on('storage', callback);
},
@AmilKey
AmilKey / router-facelift-guide.md
Last active August 28, 2015 09:49 — forked from machty/router-facelift-guide.md
Guide to the Router Facelift

Ember Router Async Facelift

The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.

@AmilKey
AmilKey / new-router-examples.md
Last active August 27, 2015 21:11 — forked from machty/new-router-examples.md
How to do cool stuff with the new Router API
@AmilKey
AmilKey / open-key.coffee
Created August 1, 2015 11:42
add open-key before load ember app
Em.onLoad 'Ember.Application', (application)->
application.initializer
name: 'OpenKey'
initialize: (container, app)->
app.deferReadiness()
url = "#{app.CONFIG.API.host}/open-key"
Ember.$.ajax
url: url
method: "GET"
success: (result, textStatus, jqXHR) ->
@AmilKey
AmilKey / gist:18ee9dbbb7855a096f26
Created June 30, 2015 11:57
rename group files in linux
for d in */; do
for f in $d*/; do
# echo $f
if [[ $f == *"4ktv_"* ]]
then
#COPY
# cp -r $f $d"xlarge/"
# echo $d"xlarge/"
#DELETE
rm -rf $f