Skip to content

Instantly share code, notes, and snippets.

@igabice
igabice / password_textfield_example.dart
Created January 8, 2020 09:50
Flutter TextField with password input type and an icon to toggle visibility
bool _showPassword = false;
Widget _buildPasswordTextField() {
return TextField(
obscureText: !this._showPassword,
decoration: InputDecoration(
labelText: 'password',
prefixIcon: Icon(Icons.security),
suffixIcon: IconButton(
icon: Icon(
@MeFoDy
MeFoDy / DailyCssImages.md
Last active September 11, 2023 12:48
Daily CSS Images: full list of tasks

Daily CSS Images

Week 1

Day 1. Bear Cub

The challenge begins! Don't overthink it. A cub can be made in only a few shapes.

Day 2. Elephant

@MeFoDy
MeFoDy / css_secrets_trigonometry.md
Last active May 3, 2020 23:50
Trigonometry usage in CSS Secrets by Lea Verou
@zcaceres
zcaceres / Revealing-Module-Pattern.md
Last active May 4, 2024 06:44
Using the Revealing Module Pattern in Javascript

The Revealing Module Pattern in Javascript

Zach Caceres

Javascript does not have the typical 'private' and 'public' specifiers of more traditional object oriented languages like C# or Java. However, you can achieve the same effect through the clever application of Javascript's function-level scoping. The Revealing Module pattern is a design pattern for Javascript applications that elegantly solves this problem.

The central principle of the Revealing Module pattern is that all functionality and variables should be hidden unless deliberately exposed.

Let's imagine we have a music application where a musicPlayer.js file handles much of our user's experience. We need to access some methods, but shouldn't be able to mess with other methods or variables.

Using Function Scope to Create Public and Private Methods

@max-mapper
max-mapper / 0.md
Last active February 25, 2024 12:24
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@whizark
whizark / sass-naming-convention.md
Last active April 25, 2023 13:55
Sass Naming Convention #sass #draft
@hltbra
hltbra / get-inbound-and-egress-sg-rules.py
Last active November 15, 2018 12:04
Get AWS ingress and egress rules for a given security group
import boto
ec2 = boto.connect_ec2()
groups = ec2.get_all_security_groups()
def get_groups_that_have_ingress_rules_to(groups, group_id):
result = []
for group in groups:
for rule in group.rules:
for grant in rule.grants:
@dhrrgn
dhrrgn / core.py
Last active March 2, 2022 04:16
Tired of doing db.session.add and db.session.commit to save your records? Have no fear, save is here. Note: This is for use with Flask-SQLAlchemy
from .user import User
def init_db(db):
"""Add a save() function to db.Model"""
def save(model):
db.session.add(model)
db.session.commit()
db.Model.save = save