Skip to content

Instantly share code, notes, and snippets.

View iamnasirudeen's full-sized avatar
🎯
Busy

Nasirudeen Olohundare iamnasirudeen

🎯
Busy
View GitHub Profile
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
var async = require('async');
// Send email
var sendEmail = function(email,callback) {
console.log("Sending email to "+email);
callback(null);
}
// create a queue object with concurrency 2
var q = async.queue(sendEmail,2);

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

@whoisryosuke
whoisryosuke / nextjs-hoc-authorization.js
Created June 26, 2018 22:24
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
@iamnasirudeen
iamnasirudeen / paystack.js
Created July 10, 2019 16:04
Paystack recurring payment
import axios from 'axios';
const createCustomer = async form => {
const options = {
url: "https://api.paystack.co/customer",
headers: {
'authorization': `Bearer ${process.env.PAYSTACK_SECRET_KEY}`,
'content-type': 'application/json',
'cache-control': 'no-cache'
},
@kosson
kosson / redincredid.ctrl.js
Created October 21, 2019 08:25
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 => {
@limistah
limistah / App.js
Last active September 5, 2021 16:39
ReactJS InplaceEdit component and consumption
import InplaceEdit from "./InplaceEdit"
class App extends React.Component {
render() {
return (
<InplaceEdit
isUpdatingId={true || false}
id={idForTheField || ""}
updateKey={keyToReturnAnObjectWith || ""}
onUpdate={functionToCallForTheUpdate || (() => {})}
@limistah
limistah / nextTick.js
Created May 1, 2020 08:05 — forked from mmalecki/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";
function flattenFolderTree(folders) {
return folders.reduce((acc, folder) => {
const {children, ...rest} = folder;
if (!children || !children.length) {
return [...acc, rest];
}
return [...acc, rest, ...flattenFolderTree(children)];
}, []);