Skip to content

Instantly share code, notes, and snippets.

View mingsai's full-sized avatar
🎯
Focusing

Tommie N. Carter, Jr. mingsai

🎯
Focusing
View GitHub Profile
@mingsai
mingsai / macos-custom-man-page.md
Last active February 27, 2022 03:13
How to create a new custom man page

Requires just terminal, nano, vi and sudo rights

Works on MacOS Monterrey+

Tips

  • Everything needs to be run in Terminal
  • Check your man search path using manpath
  • Type manpath to see available locations
  • Use share for pages accessible to all users
  • Some versions of man epect to see gzipped files
  • Check the folders of existing man pages to view file formats expected
@mingsai
mingsai / css image zoom
Last active February 18, 2022 22:28
CSS a small amount of html and multiple image sizes allow for zoom on hover
// source/exampple @ https://jsfiddle.net/mingsai/jqt0732k/2/
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<style>
#thumbwrap {
position:relative;
margin:75px auto;
--- References
https://jsfiddle.net/mingsai/ybt5pdg4/39/
(original article) https://designshack.net/articles/css/use-pseudo-elements-to-create-an-image-stack-illusion/
--- HTML
<a class='featured-img-box'>
<img src="https://st2.depositphotos.com/1653909/8228/i/950/depositphotos_82284502-stock-photo-magician-hands-with-magic-wand.jpg" height=100% width=100% />
</a>
--CSS
@mingsai
mingsai / flutter_widget_arguments.md
Created September 2, 2021 09:43
How to pass arguments between widgets in Flutter

How to pass arguments to a widget using a variable:

tldr; We have to turn our thinking on its head a bit. Data can be passed to the called widget when you navigate to it by using final arguments with default values in the destination widget. Using an optional function you can get data back from the 'child' (destination) widget.

@mingsai
mingsai / dart_super_constructor.dart
Created August 29, 2021 19:09
Flutter Super Constructor in Dart
/*
Super Constructor in Dart
In dart, the subclass can inherit all the variables and methods of the parent class, with the use of extends keyword but it can’t inherit constructor of the parent class. To do so we make use of super constructor in the dart. There are two ways to call super constructor:
Implicitly
Explicitly
When calling explicitly we make use of super constructor as:
*/
@mingsai
mingsai / gist:32461fc93d176eb3ee9f8e6f7935d94c
Last active August 29, 2021 15:29
Flutter - dismiss keyboard on tap
//wrap the layout widget for the screen with a Gesture detector having this function
GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
},
@mingsai
mingsai / pass_arguments.dart
Last active August 28, 2021 01:10
Flutter - How to pass an object using the Navigator between two screens
//View #1 Pass any object as an argument in the Navigator as part of a Map:
void _editItem(BuildContext context, int index, Box<ChecklistItem> box) {
ChecklistItem _selectedItem = box.getAt(index) as ChecklistItem;
Navigator.pushNamed(context, ChecklistEditScreen.id,
arguments: {'item': _selectedItem});
}
//View #2 Extract passed flutter arguments without passing them as parameters:
Widget build(BuildContext context) {
@mingsai
mingsai / rebuild_widgets.dart
Created August 27, 2021 18:03
Flutter rebuild all widgets
void _rebuildAllChildren(BuildContext context) {
void rebuild(Element el) {
el.markNeedsBuild();
el.visitChildren(rebuild);
}
(context as Element).visitChildren(rebuild);
}
@mingsai
mingsai / dismissible_widget_sample.dart
Created August 27, 2021 18:02
Dismissable Widget Sample
return Dismissible(
key: Key(index.toString()),
onDismissed: (direction) {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => AlertDialog(
content: Text(
"Do you want to delete task ${currentItem.title}?",
),
@mingsai
mingsai / .gitignore
Last active March 10, 2021 12:23
Flutter projects git ignore
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/