-
Data Down / Actions Up
- http://emberjs.jsbin.com/nayaho/edit?html,js - Interdependent select boxes. No observers.
- http://ember-twiddle.com/2d7246875098d0dbb4a4 - One Way Input
-
Other
- http://emberjs.jsbin.com/rwjblue/251/edit?html,js,output - Opening a window and communicate with it.
- http://emberjs.jsbin.com/rwjblue/55/edit - Using liquid-fire animations in globals mode.
- http://emberjs.jsbin.com/rwjblue/593/edit - Modify computed dependent keys after initialization.
- http://emberjs.jsbin.com/siforo/edit?js,output - Define computed property after object initialization.
-
http://emberjs.jsbin.com/rwjblue/299/edit?js,output - simplified version of ic-ajax
| import Ember from 'ember'; | |
| export { dirtyHasMany, dirtyBelongsTo, dirtyMixin }; | |
| var dirty = 'relationshipIsDirty'; | |
| function dirtyMixin (obj) { | |
| var args = Object.keys(obj); | |
| var comp = Ember.computed; | |
| args.push('isDirty'); | |
| obj[dirty] = comp.any.apply(comp, args); |
| import Ember from 'ember'; | |
| import DS from 'ember-data'; | |
| var computed = Ember.computed; | |
| var get = Ember.get; | |
| var RSVP = Ember.RSVP; | |
| export default DS.Model.extend({ | |
| name: DS.attr('string'), | |
| players: DS.hasMany('player', { async: true }), |
| var flattenObject = function(ob) { | |
| var toReturn = {}; | |
| for (var i in ob) { | |
| if (!ob.hasOwnProperty(i)) continue; | |
| if ((typeof ob[i]) == 'object') { | |
| var flatObject = flattenObject(ob[i]); | |
| for (var x in flatObject) { | |
| if (!flatObject.hasOwnProperty(x)) continue; |
| export DOKKU_HOST=$HOSTNAME | |
| export PUBLIC_KEY=~/.ssh/id_rsa.pub | |
| export DEVELOPER=john | |
| cat $PUBLIC_KEY | ssh root@$DOKKU_HOST "sudo sshcommand acl-add dokku $DEVELOPER" |
| export http_proxy= | |
| export https_proxy= | |
| curl -XDELETE 'http://localhost:9200/test/' | |
| echo "Creating the mapping" | |
| curl -XPUT 'http://localhost:9200/test/?pretty=1' -d ' | |
| { | |
| "mappings" : { | |
| "member" : { |
| # clean everything up | |
| echo "killing mongod and mongos" | |
| killall mongod | |
| killall mongos | |
| echo "removing data files" | |
| rm -rf data/config | |
| rm -rf data/shard* | |
| # For mac make sure rlimits are high enough to open all necessary connections | |
| ulimit -n 2048 |
Tether is a great library for positioning stuff (tooltips, modals, hints, etc) in your web app.
But, as I use React, it was pretty problematic for me, as Tether mutates the DOM and React breaks miserably when it sees mutated DOM. The solution is to have the tethered element outside the part of the DOM tree which is controlled by React (in this case, I use document.body).
That's why I created 2 helpers to use Tether with React.
The first one, TetheredElement is a plain JS helper to create a new element, attach it to some other one via Tether, and populate it with some React component.
The second one, TetherTarget is a React component and it uses TetheredElement to integrate it further with React, so that you can attach components to each other with Tether, without leaving the cozy React/JSX world and worrying about manual DOM operations. Just write:
| [https://gist.github.com/stephou0104/233b5c99884f1d8c8b8b#file-ubuntu-compass-ruby] | |
| sudo apt-get update | |
| sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties | |
| sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev | |
| curl -L https://get.rvm.io | bash -s stable | |
| gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 | |
| source ~/.rvm/scripts/rvm | |
| echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc |
| # Configuration for Alacritty, the GPU enhanced terminal emulator | |
| # Any items in the `env` entry below will be added as | |
| # environment variables. Some entries may override variables | |
| # set by alacritty it self. | |
| env: | |
| # TERM env customization. Default is xterm-256color | |
| # Note: the default TERM value `xterm-256color` does not | |
| # specify all features alacritty supports. This does pose |