Skip to content

Instantly share code, notes, and snippets.

Avatar

Jefferson Ribeiro jeffersonRibeiro

View GitHub Profile
@jeffersonRibeiro
jeffersonRibeiro / nextjs-ssr-csr-auth-hoc.js
Last active Jun 13, 2020
Nextjs HOC to deal with authentication for SSR and CSR pages
View nextjs-ssr-csr-auth-hoc.js
import React from 'react';
import { Router } from 'next-router';
import getAuthSession from 'services/authSession';
function redirect(res) {
if (res) {
// SSR
res.writeHead(302, { Location: '/' });
res.end();
View gist:f96940fcbf14ad50b4a96d14f80bf1b0
@media screen and (min-aspect-ratio: 16/9) {
.background {
width: 100%;
height: auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@jeffersonRibeiro
jeffersonRibeiro / isElection.js
Created Oct 8, 2018
remove posição para lista de sistes
View isElection.js
/* Remove banner_slb_topo no período de eleição para páginas com régua de apuração */
(function() {
var isElection = false;
console.log('[ADS] Eleicao Ativa:', isElection);
if( isElection && hasElectionHeader() ) {
for(var i = 0; i < desktop_positions_list.length; i++) {
if(desktop_positions_list[i].id === 'banner_slb_topo') {
desktop_positions_list.splice(i, 1);
break;
}
View nonblock.c
#include <unistd.h>
#include <stdio.h>
// cc.byexamples.com calls this int kbhit(), to mirror the Windows console
// function of the same name. Otherwise, the code is the same.
bool inputAvailable()
{
struct timeval tv;
fd_set fds;
tv.tv_sec = 0;
You can’t perform that action at this time.