Skip to content

Instantly share code, notes, and snippets.

View lambda2's full-sized avatar
🌴

André Aubin lambda2

🌴
View GitHub Profile
@lambda2
lambda2 / one_more_time.php
Created April 3, 2014 19:41
Nouvelle journée. Toujours bloqué sur cette maudite île.
#!/usr/bin/php
<?php
date_default_timezone_set('Europe/Paris');
function another_world($str)
{
$splitted = explode(" ", $str);
foreach ($splitted as $key => $value) {
$splitted[$key] = ucfirst($value);
}
$str = implode(" ", $splitted);
@lambda2
lambda2 / form.html.erb
Created June 12, 2014 17:00
Nested Comments in Quotes
<%= simple_form_for @quote do |m| %>
<%= m.simple_fields_for :comments do |p| %>
<%= p.input :content %>
<% end %>
<% end %>
@lambda2
lambda2 / IDEES.md
Last active August 29, 2015 14:06
Idées d'exercices sur les chaines de caractères, inspirées de la librairie javascript underscore.string (https://github.com/epeli/underscore.string)

numberFormat _.numberFormat(number, [ decimals=0, decimalSeparator='.', orderSeparator=','])

Formats the numbers.

_.numberFormat(1000, 2)
=> "1,000.00"

_.numberFormat(123456789.123, 5, '.', ',')
=&gt; "123,456,789.12300"
@lambda2
lambda2 / zshrc
Created October 26, 2014 19:15
zshrc
-='cd -'
..='cd ..'
...='cd ../..'
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
@lambda2
lambda2 / gist:0e01e12f353b3255059d
Last active August 29, 2015 14:08
Prevent overflow scrolling
$ ->
item = $('[data-prevented-scroll]')
h = item.height()
sh = item.get(0).scrollHeight
item.bind 'mousewheel', (e, d) ->
e.preventDefault() if (@.scrollTop is (sh - h) and d < 0) or (@.scrollTop is 0 and d > 0)
@lambda2
lambda2 / preferences.sublime-settings
Created December 14, 2014 00:36
preferences.sublime-settings
{
"font_size": 12.0,
"ignored_packages":
[
"Vintage"
],
"rulers":
[
80
],
@lambda2
lambda2 / after.json
Created July 4, 2015 14:08
Modifications d'API pour la v1.4.2 user#show
{
"id": 14367,
"login": "adent",
"email": "adent@student.42.fr",
"alias": [
"adent@student.42.fr",
"dent.arthur@student.42.fr",
"arthur.dent@student.42.fr"
],
"display_name": "Arthur Dent",
@lambda2
lambda2 / pizza.md
Created July 12, 2015 18:49
liste pizzas

Bobol

Reine en L Pates bolognaise

Laurie

Bankok en M

Mathieu

@lambda2
lambda2 / Debian 7.8.md
Last active September 22, 2015 15:22 — forked from ChuckJHardy/digital_ocean_setup.md
Debian 7.8 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

Debian 7.8 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

$ passwd

The ProjectsUser represents the subscription of an user on a project. A subscribed user can have one or more teams based on his number of attempts to this project. Be careful to always select the active team (the last team).

Here is basically the different states a user can have on a project:

  • He (the user) has't any projects_user, he is not registered on the project.
  • He has no team, he is actually searching a group, in order to make one.
  • He has a team, wich is not locked (the locked_at field is not null), he is creating a group.

If the user have a locked team, he did, or he is doing the project. At this point, the available states are:

  • His team is closed and has a final_mark (the locked_at, closed_at and final_mark fields aren't null), he has finished his project. If he don't have a final_mark yet, he his waiting for correction.