Skip to content

Instantly share code, notes, and snippets.

Mauricio Ribeiro MauricioRibeiroA

Block or report user

Report or block MauricioRibeiroA

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MauricioRibeiroA
MauricioRibeiroA / index.php
Created Aug 7, 2017 — forked from cosenary/index.php
Instagram API login (with sessions)
View index.php
<?php
require '../src/Instagram.php';
use MetzWeb\Instagram\Instagram;
session_start();
if (isset($_SESSION['access_token'])) {
// user authentication -> redirect to media
header('Location: success.php');
@MauricioRibeiroA
MauricioRibeiroA / diagonals.rb
Created Feb 16, 2017 — forked from EvilScott/diagonals.rb
Retrieve diagonals from array of arrays in Ruby
View diagonals.rb
class Array
def diagonals
[self, self.map(&:reverse)].inject([]) do |all_diags, matrix|
((-matrix.count + 1)..matrix.first.count).each do |offet_index|
diagonal = []
(matrix.count).times do |row_index|
col_index = offet_index + row_index
diagonal << matrix[row_index][col_index] if col_index >= 0
end
all_diags << diagonal.compact if diagonal.compact.count > 1
@MauricioRibeiroA
MauricioRibeiroA / diagonals.rb
Created Feb 16, 2017 — forked from EvilScott/diagonals.rb
Retrieve diagonals from array of arrays in Ruby
View diagonals.rb
class Array
def diagonals
[self, self.map(&:reverse)].inject([]) do |all_diags, matrix|
((-matrix.count + 1)..matrix.first.count).each do |offet_index|
diagonal = []
(matrix.count).times do |row_index|
col_index = offet_index + row_index
diagonal << matrix[row_index][col_index] if col_index >= 0
end
all_diags << diagonal.compact if diagonal.compact.count > 1
You can’t perform that action at this time.