Skip to content

Instantly share code, notes, and snippets.

View lambda2's full-sized avatar
🌴

André Aubin lambda2

🌴
View GitHub Profile
@lambda2
lambda2 / getHeure.js
Created November 6, 2013 08:14
Affiche l'heure courant ou truc dans le container avec l'id donnée en paramètre (ici, heure)
function getHeure(container, utc)
{
d = new Date()
if (utc)
{
t = date.getUTCHours()+":"date.getUTCMinutes()+":"+date.getUTCSeconds();
}
else
{
t = date.getHours()+":"date.getMinutes()+":"+date.getSeconds();
.mejs-controls .mejs-time-rail .mejs-time-total
{
margin: 5px 0px;
}
@lambda2
lambda2 / ft_memrealloc.c
Created November 28, 2013 02:40
ft_memrealloc.c
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memrealloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aaubin <aaubin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/11/28 02:36:34 by aaubin #+# #+# */
/* Updated: 2013/11/28 03:35:07 by aaubin ### ########.fr */
/* */
@lambda2
lambda2 / tests.rules
Created December 6, 2013 06:53
Petits tests pour le ft_ls
-t#.
-t#..
-l#.
-l#..
-t#
-l#
-la#
-lar#
-lart#
-la#
@lambda2
lambda2 / ft_printf_test.c
Last active November 26, 2017 16:35
Test file for ft_printf
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_test.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aaubin <aaubin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/12/16 10:10:21 by aaubin #+# #+# */
/* Updated: 2013/12/16 10:10:34 by aaubin ### ########.fr */
/* */
@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)