Skip to content

Instantly share code, notes, and snippets.

View jeanbono's full-sized avatar

Pierre Fraisse jeanbono

  • Delia Technologies
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jeanbono on github.
  • I am jeanbono (https://keybase.io/jeanbono) on keybase.
  • I have a public key ASCfxeLJbk3HJ8bDBYyDbalIjecMWJ3s6S9qQPzNyc7TmQo

To claim this, I am signing this object:

import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
arr: [1, 2, 3],
test: Ember.computed.sort('arr', function(a, b) {
console.log(this.get('arr'));
if(a > b) {
return 1;
} else if(a < b) {
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var adapter = require('socket.io-redis');
var redis = require('redis').createClient;
var rds = require("url").parse(process.env.REDIS_URL);
var pub = redis(rds.port, rds.hostname, { auth_pass: rds.auth.split(':')[1] });
var sub = redis(rds.port, rds.hostname, { detect_buffers: true, auth_pass: rds.auth.split(':')[1] });
<% if @opportunity.errors.any? %>
<div id="error_explanation">
<h2>
<%= pluralize(@opportunity.errors.count, "error") %>
prohibited this opportunity from being saved:
</h2>
<ul>
<% @opportunity.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
private
def opportunity_params
params.require(:opportunity).permit(:name, :description, :amount, :closedate, :stagename)
end
def destroy
@opportunity = Opportunity.find(params[:id])
@opportunity.destroy
redirect_to opportunities_path
end
def update
@opportunity = Opportunity.find(params[:id])
if @opportunity.update(opportunity_params)
redirect_to @opportunity
else
render 'edit'
end
end
def edit
@opportunity = Opportunity.find(params[:id])
end
<h1>Edit opportunity</h1>
<%= form_for :opportunity, url: opportunity_path(@opportunity), method: :patch do |f| %>
<p>
<%= f.label :name %><br>
<%= f.text_field :name %>
</p>
<p>
<%= f.label :description %><br>