Skip to content

Instantly share code, notes, and snippets.

View hadrienblanc's full-sized avatar

Hadrien Blanc hadrienblanc

  • Paris, France
View GitHub Profile
<?php
/*
*
*/
$folder_to_action = "Report-PAR-3-1";
function recursiveRemoveDirectory($directory)
{
foreach(scandir($directory) as $file)
;;
;; Print Hello World! 10 times with a loop in ASM
;; nasm -f elf64 helloLoop.asm
;; ld helloLoop.o
;;
global _start
section .text
_start:
<?php
require_once("parse_csv.php");
$data = parse_csv(file_get_contents("forward.csv"));
$people = parse_csv(file_get_contents("people.csv"));
$top = "name,code,master,member0,member1,member2,member3,member4,member5,member6,member7";
$eip_groups = explode("\n",
#include <sys/socket.h>
#include <stdlib.h> // exit
#include <stdio.h> // printf
#include <netinet/in.h> // bind - types
#include <sys/select.h> // select
#include <sys/types.h> // read
#include <sys/uio.h> // read
version: '2'
services:
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/myapp
ports:
- "3000:3000"
depends_on:
'atom-text-editor':
'cmd-l': 'editor:auto-indent'
module Miouable
def miouw
puts 'miouw !'
end
end
class CatWithExtend
extend Miouable
end
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.

You can break these rules if you can talk your pair into agreeing with you.

source : Sandi Metz' Rules For Developers from thoughtbot blog (https://robots.thoughtbot.com/sandi-metz-rules-for-developers)

@hadrienblanc
hadrienblanc / ruby_overlooked_methods.md
Last active December 19, 2018 09:06
Overlooked methods of the ruby object

Ruby object

Overlooked methods of the ruby object.

yield_self {|x| block } → an_object

(ruby 2.5) Yields self to the block and returns the result of the block.

@hadrienblanc
hadrienblanc / git-submodules.md
Last active December 9, 2023 01:13
Git submodules cheatsheet

Git Submodules cheatsheet

Why having a submodule ?

With git you can add a submodule to a repository. A submodule is another repository inside a repository.

How to create a submodule ?

git submodule add [email protected]:my_account/my_submodule.git path_to_my_submodule