Skip to content

Instantly share code, notes, and snippets.

View abdoulmouctard's full-sized avatar
🎯
Focusing

Mouctar DIALLO abdoulmouctard

🎯
Focusing
View GitHub Profile
scalar Date
type Comment {
user(id: String!): User!
issue(id: String!): Issue!
content: String!
createdAt: Date!
updatedAt: Date!
}
import { combineResolvers } from 'graphql-resolvers';
import { omitBy, isNil } from 'lodash';
import { authorize } from './auth.resolver';
import { USER, ADMIN } from '../../models/user.model';
import { Paginate } from './pagination.resolver';
export default {
Query: {
Comment: combineResolvers(authorize(USER), async (parent, { id }, { models }) => models.Comment.findById(id)),
Comments: combineResolvers(authorize(USER), Paginate('Comment')),
mdp
formula lfree = (p2>=0&p2<=4)|p2=6|p2=10;
formula rfree = (p3>=0&p3<=3)|p3=5|p3=7|p3=11;
module phil1
p1: [0..11];
[] p1=0 -> (p1'=1); // trying
<?php
function calculator(string $text) {
$word = str_word_count(strip_tags($text));
$minute = floor($word / 200);
$second = floor($word % 200 / (200 / 60));
$result = $minute . ' minute' . ($minute == 1 ? '' : 's') . ', ' . $second . ' second' . ($second == 1 ? '' : 's');
return $result;
}
@abdoulmouctard
abdoulmouctard / fetch_through_curl.php
Last active December 16, 2020 09:06
Secure Fetch with Curl in PHP
<?php
function get_web_page(string $url, string $username, string $password)
{
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
// CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
// CURLOPT_ENCODING => "", // handle all encodings
// CURLOPT_USERAGENT => "spider", // who am i
import Vue from "vue";
import VueRouter from "vue-router";
import Index from "../pages/Index.vue"; // Index Component HERE
import { admin, authenticated, manager, standard } from "../middleware"; // Middleware PATH
Vue.use(VueRouter);
const admins = [];
@abdoulmouctard
abdoulmouctard / table_backup.php
Last active April 21, 2021 09:29
MYSQL TABLE ARCHIVER
<?php
/* ------------------------------------------
* MYSQL TABLE ARCHIVER
* ------------------------------------------
* This script use old versions of PHP.
* So you need to change mysqli connections
* by the new syntaxes (PDO, mysql)
* ------------------------------------------
* php table_backup.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Culture Pro</title>
</head>
<body>
<form id="form">
@abdoulmouctard
abdoulmouctard / lazy-collection.php
Last active September 20, 2023 19:03
Laravel Lazy Collection From CSV
<?php
LazyCollection::macro("fromCsv", function (string $path, int $chunk = 0, string $separator = ";"): LazyCollection {
/** @var LazyCollection $collection */
$collection = static::make(function () use (&$separator, &$path, &$chunk) {
$handle = fopen($path, 'r');
while ($line = fgetcsv(stream: $handle, separator: $separator)) {
yield array_map(fn ($item) => trim($item), $line);
}
});
@abdoulmouctard
abdoulmouctard / helpers.php
Created December 28, 2021 08:57
Laravel Helpers
<?php
use App\Client\ClientApplicationInterface;
// use App\Exceptions\Fail;
use App\Models\Contracts\Notifiable;
use App\Models\PersonalAccessToken;
use App\Notifications\Notification;
use Carbon\Carbon;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\View\Factory;