Skip to content

Instantly share code, notes, and snippets.

View ghigt's full-sized avatar

Ghislain Guiot ghigt

  • Paris
View GitHub Profile
diff --git a/app/views/collections/_fields.html.slim b/app/views/collections/_fields.html.slim
index 7309524..d576241 100644
--- a/app/views/collections/_fields.html.slim
+++ b/app/views/collections/_fields.html.slim
@@ -1,15 +1,10 @@
= render 'shared/error_messages', model: @collection
-<<<<<<< HEAD
-= f.label :name
-= f.text_field :name
@ghigt
ghigt / app.go
Created January 19, 2015 13:56
Simple discovery app in go using consul
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strconv"
"github.com/armon/consul-api"
2015-01-29T22:28:33.320310+00:00 app[web.1]: Started GET "/en/activities" for 85.168.7.56 at 2015-01-29 22:28:33 +0000
2015-01-29T22:28:33.337932+00:00 app[web.1]: Rendered public_activity/user/_new_friend.html.slim (3.3ms)
2015-01-29T22:28:33.346642+00:00 app[web.1]: Rendered public_activity/critic/_create.html.slim (4.6ms)
2015-01-29T22:28:33.352320+00:00 app[web.1]: Rendered public_activity/collection/_create.html.slim (1.5ms)
2015-01-29T22:28:33.362628+00:00 app[web.1]: Rendered public_activity/critic/_create.html.slim (4.8ms)
2015-01-29T22:28:33.322875+00:00 app[web.1]: Processing by ActivitiesController#index as HTML
2015-01-29T22:28:33.322945+00:00 app[web.1]: Parameters: {"locale"=>"en"}
2015-01-29T22:28:33.333041+00:00 app[web.1]: Rendered public_activity/collection/_follow.html.slim (2.5ms)
2015-01-29T22:28:33.341242+00:00 app[web.1]: Rendered public_activity/user/_new_friend.html.slim (2.5ms)
2015-01-29T22:28:33.349798+00:00 app[web.1]: Rendered public_activity/interest/_adding.html
@ghigt
ghigt / gist:7066e6ca75734334de7f
Last active August 29, 2015 14:23
Mysql update via brew

$ brew update && brew upgrade --all

[...]

==> Installing mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.6.25.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mysql-5.6.25.yosemite.bottle.tar.gz
@ghigt
ghigt / gist:5934282
Last active December 19, 2015 09:39

./configure :

./configure --with-ruby-sitedir=~/.rvm/rubies/ruby-1.9.3-p448/lib/ruby
--prefix=`echo ~`/.rvm/rubies/ruby-1.9.3-p448
--disable-mod-activation --without-apache-libexecdir

Avec ruby1.9 et Subversion 1.8.0 :

@ghigt
ghigt / gist:5975833
Created July 11, 2013 14:16
Error upgrading to rails3.1
✗ rails s
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`.

Exiting
@ghigt
ghigt / gist:6038564
Created July 19, 2013 11:42
Problem jquery

StudentController#populate:

  def populate
    # Process:
    # 1. AJAX call made by jQuery to populate the student table
    # 2. Find students from the database
    # 3. Pass in the student data into the helper function (construct_table_rows defined in UsersHelper)
    @students_data = Student.all(:order => 'user_name',
                                 :include => [:section,
 :grace_period_deductions])
@ghigt
ghigt / gist:6053886
Created July 22, 2013 13:40
Problems with tests

In test/functionals/groups_controller_test.rb:

should 'be able to add group without groupname' do
  Assignment.any_instance.stubs(:add_group).returns(Grouping.make)
  post_as @admin,
    :add_group,
    :assignment_id => @assignment.id
  [...]
end
@ghigt
ghigt / gist:6077619
Last active December 20, 2015 05:19
Problem with rendering a js.erb file in tests

[Ruby 1.8.7, Rails 3.0]

I want to call annotation_categories/add_annotation_category.js.erb with the action add_annotation_category.

It works well with an Ajax request, but it doesn't work in my tests.

I know that the problem comes from :formats => [:html] which should be :formats => [:js], but I don't understand why I have this behavior with .js.erb and not with rjs (I'm moving from Prototype to jQuery).

In the Controller:

@ghigt
ghigt / (EN) README.md
Last active December 20, 2015 12:18
From Prototype to jQuery

For a little over two weeks, I had the opportunity to learn JavaScript by working on an issue on the MarkUs's GitHub. This issue is about updating the MarkUs application from Prototype to jQuery. Indeed, in order for MarkUs to migrate to Rails 3.1 (it is currently implemented with Rails 3.0), it has to support the new default javascript library, jQuery, hence motivating this work.

As I had never programmed in Javascript before, the first step was to document myself on javascript, but also to learn how Prototype and jQuery worked. Fortunately, these two libraries have a fairly extensive documentation (Prototype API & jQuery API).

Merge old Pull Request and Master

A student, @m-bodmer had already tackled this issue a while back when working on MarkUs. Thankfully, he had created a pull request (link), and I co