Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/widgets.dart';
// From https://gist.github.com/ltOgt/3771c824fc1c8811f5ec1a81a9a4937b
/// Conditionally wrap a subtree with a parent widget without breaking the code tree.
///
/// [condition]: the condition depending on which the subtree [child] is wrapped with the parent.
/// [child]: The subtree that should always be build.
/// [parentBuilder]: builds the parent with the subtree [child].
///
@Muhammed-Rahif
Muhammed-Rahif / islamic-quiz-api.json
Last active January 11, 2023 13:51
Islamic Quiz Api Json
[
{
"question": "What is the name of the holy book of Islam?",
"answers": ["The Qur'an", "The Bible", "The Vedas", "The Sutras"],
"source": "....Quran was revealed as a guide for humanity with clear proofs of guidance and the standard ˹to distinguish between right and wrong˺.... -Qur'an, Surah Al-Baqarah 2:185",
"answerIndex": 0
},
{
"question": "Which of the following is not one of the Five Pillars of Islam?",
"answers": ["Prayer", "Fasting", "Charity", "Hiking"],
@sindresorhus
sindresorhus / esm-package.md
Last active June 16, 2024 19:05
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@Muhammed-Rahif
Muhammed-Rahif / express-app.js
Last active September 6, 2021 14:56
This is a mongodb localhost:27017 connection code in node js express. We can connect simply mongodb(PORT: localhost:27017 ) to our node js project as this code...
db.connect((err)=>{
if (err) {
console.log("Database connection Error :"+err);
}else{
console.log("Database connected to port 27017");
}
})
@ltOgt
ltOgt / conditional_parent_widget.dart
Created June 29, 2020 14:50
Flutter Widget to conditionally wrap a subtree with a parent without breaking the code tree
import 'package:flutter/widgets.dart';
/// Conditionally wrap a subtree with a parent widget without breaking the code tree.
///
/// [condition]: the condition depending on which the subtree [child] is wrapped with the parent.
/// [child]: The subtree that should always be build.
/// [conditionalBuilder]: builds the parent with the subtree [child].
///
/// ___________
/// Usage:
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active June 17, 2024 00:05
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@parmentf
parmentf / GitCommitEmoji.md
Last active June 16, 2024 18:45
Git Commit message Emoji
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],