Skip to content

Instantly share code, notes, and snippets.

View iamnasirudeen's full-sized avatar
🎯
Busy

Nasirudeen Olohundare iamnasirudeen

🎯
Busy
View GitHub Profile
http://stackoverflow.com/questions/12168452/long-lasting-fb-access-token-for-server-to-pull-fb-page-info/21927690#21927690
Having found that it is possible to generate a Facebook Page Access Token that does not expire (with help from @Igy), here is a clear, step-by-step quide for all those looking to the same:
1. Make sure you are the admin of the FB page you wish to pull info from
2. Create a FB App (should be with the same user account that is the page admin)
3. Head over to the Facebook Graph API Explorer
4. On the top right, select the FB App you created from the "Application" drop down list
5. Click "Get Access Token"
6. Make sure you add the manage_pages permission
@iamnasirudeen
iamnasirudeen / nextjs-hoc-authorization.js
Created April 28, 2021 20:37 — forked from whoisryosuke/nextjs-hoc-authorization.js
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@iamnasirudeen
iamnasirudeen / net.js
Created March 14, 2021 00:22
A simple explanation on how eventLoop works
const EventEmitter = require("events");
function net() {
this.emitEvent = this.emitEvent.bind(this);
this.onConnection = this.onConnection.bind(this);
}
net.prototype = EventEmitter.prototype;
net.prototype.createServer = function(cb) {
```
import Notification from "../../models/Notifications";
const eventNames = require("./eventNames");
const userManager = require("./userManager");
const notificationEvent = async (
io,
socket,
userId,
notification = { name: "test" }
@iamnasirudeen
iamnasirudeen / nextTick.js
Created June 14, 2020 12:34 — forked from limistah/nextTick.js
process.nextTick vs setTimeout(fn, 0)
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}
import AWS from "aws-sdk";
import { v2 as cloudinary } from "cloudinary";
import crypto from "crypto";
import fs from "fs";
import Jimp from "jimp";
import path from "path";
import gifsicle from "gifsicle";
import { execFile } from "child_process";
import sizeOf from "image-size";
import Settings from "../models/settings";
@iamnasirudeen
iamnasirudeen / redincredid.ctrl.js
Created February 3, 2020 08:53 — forked from kosson/redincredid.ctrl.js
This is how content data generated by Editor.js could be transformed back into html.
const resursaModel = require('../../models/resursa-red');
const competenteS = require('../../models/competenta-specifica');
module.exports = (params) => {
return resursaModel.find({_id: params.idres}).populate({
path: 'competenteS'
}).exec().then( (resursa) => {
// console.log(resursa);
if (resursa[0].content) {
let articleHTML = '';
resursa[0].content.blocks.map(obj => {
@extends('admin.layouts.app')
@section('content')
<div class="container-fluid" id="menu-app" data-id="{{$row->id ?? ''}}" v-cloak>
<div class="d-flex justify-content-between mb20">
<h1 class="title-bar">
@if(!empty($row->id))
{{__("Edit Menu:")}} @{{name}}
@else
{{__('Create new menu')}}
@extends('admin.layouts.app')
@section('content')
<div class="container-fluid" id="menu-app" data-id="{{$row->id ?? ''}}" v-cloak>
<div class="d-flex justify-content-between mb20">
<h1 class="title-bar">
@if(!empty($row->id))
{{__("Edit Menu:")}} @{{name}}
@else
{{__('Create new menu')}}