Skip to content

Instantly share code, notes, and snippets.

View ghigt's full-sized avatar

Ghislain Guiot ghigt

  • Paris
View GitHub Profile
@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

@ghigt
ghigt / gist:6163048
Created August 6, 2013 09:23
Problem with rvm
$ rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.8.7-p374.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.8.7-p374, this may take a while depending on your cpu(s)...
ruby-1.8.7-p374 - #downloading ruby-1.8.7-p374, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (22) The requested URL returned error: 404
@ghigt
ghigt / README.md
Created August 7, 2013 07:33
Problem installation Ruby, subversion...
$ tar xf subversion-1.7.11.tar.gz
$ cd subversion-1.7.11
$ ./configure --with-ruby-sitedir=/usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby --prefix=/usr/local/rvm/rubies/ruby-1.8.7-p374/ --disable-mod-activation --without-apache-libexecdir
$ make
$ make swig-rb
$ make install
$ make install-swig-rb
@ghigt
ghigt / REAMDE.md
Last active March 24, 2017 15:58
Fix problems with locales

Run script.sh as:

curl -L https://gist.github.com/GhiGt/6185331/raw/26ecb9da925fbb31ce25799a30e7a889a675934a/script.sh | sudo bash

Then restart.

@ghigt
ghigt / _boot.js.erb
Last active December 20, 2015 23:28
Post Blog Markus [do not touch!]
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
users_table = new FilterTable({
[...]
});
});
new Ajax.Request('<%=populate_students_path()%>',