- Intégration du design de Kaoji ;
- Création d'une vue (depuis une recherche) ;
- Affichage du nombre de sujets non lus à côté du nom de la vue ;
- Gestion des lu/non lu dans la messagerie privée ;
- Abonnement à une discussion ;
- Notifications par mail et sur le site ;
- Ajout de tags à une recherche par autocomplete (http://textextjs.com/) ;
- Recherche avancée (par auteur, date et mot-clé) ;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Watchlist | |
# Will generate SELECT * FROM users WHERE id IN(SELECT user_id FROM watchlistings WHERE item_id = ...)). | |
# Instead of two queries (one to pluck the ids, the other to get the watchlistings. | |
def self.users_watching(item) | |
ids = Watchlisting.where(item_id: item.id).select(:user_id) | |
User.where(id: ids) | |
end | |
def initialize(user) | |
@user = user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BuyWeaponTest < ActiveSupport::TestCase | |
test "User buys a weapon" do | |
mp5 = WeaponType.create('mp5', gold: 40) | |
ak47 = WeaponType.create('ak47', gold: 100) | |
argo = User.create(name: 'Argo', gold: 100) | |
argo_mp5 = Weapon.create(weapon_type: mp5, user: argo) | |
UserBuysWeapon.new(user, ak47).perform! | |
assert_equal ak47, argo.weapon.weapon_type, "User's new weapon should be a AK-47" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frequency = 50/1000 # 50 ms | |
loop do | |
moving_objects = Ship.all + Projectile.all | |
moving_objects.each do |moving_object| | |
moving_object.move | |
moving_object.collisions.each do |collision| | |
collision.object.collides_with(collision.other_object) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.inGroupsOf = function(array, number, fillWith) { | |
fillWith = fillWith || null; | |
var index = -number, slices = []; | |
if (number < 1) return array; | |
while ((index += number) < array.length) { | |
var s = array.slice(index, index + number); | |
while(s.length < number) | |
s.push(fillWith); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(sector). | |
-export([ start/0, loop/1 ]). | |
-record(ship, { x, y }). | |
start() -> | |
io:format("Hello world!~n"), | |
Ship = #ship{ x = 1, y = 2 }, | |
OtherShip = #ship{ x = 2, y = 2 }, | |
Ships = [ Ship, OtherShip ], | |
spawn(?MODULE, loop, [ Ships ]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Application::Application.routes.draw do | |
get '/my_favorites', to: 'favorites#my_index' | |
resources :users do | |
resources :favorites, only: [ :index ] | |
end | |
resources :favorites, only: [ :destroy ] | |
namespace :bookmarklet do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Views.ProfileSummary extends Backbone.View | |
template: JST['side_bar/profile_summary'] | |
events: | |
'click .favorites' : 'goToFavorites' | |
render: -> | |
html = @template | |
currentUser: Store.get('currentUser') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render: -> | |
$html = $(@template(vehicle: @vehicle)) | |
$groups = $html.filter('.groups') | |
_(@groups).each (group)=> | |
subview = new App.Views.AttributesGroup(group: group, vehicle: @vehicle) | |
$groups.append(subview.render().el) | |
$(@el).html($html) | |
@ |