Skip to content

Instantly share code, notes, and snippets.

View kevinmungai's full-sized avatar

Kevin Mungai kevinmungai

View GitHub Profile
andre-bahia / CurrencyPtBrInputFormatter.dart
Last active April 29, 2024 15:06
Flutter TextInputFormatter Currency pt_BR
import 'package:flutter/services.dart';
import 'package:intl/intl.dart';
class CurrencyPtBrInputFormatter extends TextInputFormatter {
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
if(newValue.selection.baseOffset == 0){
return newValue;
leopoldodonnell /
Last active July 14, 2024 20:34
Install and run Postgres with an extension using docker-compose

Local Postgres

This gist is an example of how you can simply install and run and extended Postgres using docker-compose. It assumes that you have docker and docker-compose installed and running on your workstation.


  • Requires docker and docker-compose
  • Clone via http: git clone
  • Make executable
  • Build the image: docker-compose build
jbrown123 / -Recursive Queries Using Common Table
Last active July 12, 2024 11:34
Creating arbitrary-depth recursive queries in SQLITE (works for any SQL compliant system) using CTEs (common table expressions)

Recursive Queries Using Common Table Expressions

Common Table Expressions (CTEs) are a bit complex and difficult to understand at first blush. Many of the tutorials and examples on the net don't make it any easier for those just starting out. I thought I'd put together a quick gist that tries to simplify the concept and demonstrate how to do recursive queries using CTEs.

Keep in mind that CTEs have other uses besides just recursive queries but this gist is just about how they can be used to create recursive searches.

I'm using SQLite in this example but any SQL language that implements the WITH keyword should be able to do the same thing. If you've never used SQLite before, you are missing out on an amazing, open source, stand alone, SQL engine. I encourage you to check it out.

A practical example

pbostrom /
Last active March 8, 2024 07:53
Loading third-party npm modules in ClojureScript

Loading third-party npm modules in ClojureScript

This example shows how to load the re-resizable npm module which provides a resizable React component. Requires the lein-npm plugin.

  1. Add the npm module to the :npm :dependencies section of project.clj:
 :npm {:package {:scripts {:build "webpack -p"}}
       :dependencies [[react "16.4.0"]
                      [react-dom "16.4.0"]
                      ["@cljs-oss/module-deps" "1.1.1"]
jamesnyika / React Navigation V3+ in
Last active November 16, 2020 14:10
React Navigation V3+ in Clojurescript

React Navigation is a great component for building mobile applications. It is versatile and supports both dominant platforms beautifully. However, despite the 2 libraries that exist out there to support this component in the Clojure ecosystem, there is sadly very little documentation on what and how you can set up and use this component. I could not get them to work for me (my failing) so I decided to try and make it work without the existing libraries just to that I can understand what is going on. Below is a laying out of my experience. Let me know if you have corrections so that we mortals who are not that sharp can learn.

React Navigation requires an exact set of steps to make it successfully work

Step 1: Installation of React Navigation

Use yarn to add the library to the project

gokulkrishh / media-query.css
Last active July 16, 2024 10:52
CSS Media Queries for Desktop, Tablet, Mobile.
##Device = Desktops
##Screen = 1281px to higher resolution desktops
@media (min-width: 1281px) {
/* CSS */
dmckeone / gist:69334e2d8b27f586414a
Last active February 11, 2023 15:28
Using virtualenv under PostgreSQL PL/Python

(All of this code tested in Enterprise DB PostgreSQL 9.4 Beta 1 and Python 3.3)

As of Virtualenv 1.3 ( (and excluding Python 3.4's venv) there is an file within a virtualenv package that allows activation of a virtual environment within an embedded version of Python (like PostgreSQL's PL/Python). A Python 2/3 compatible version looks like this:


Where /Some/VirtualEnv/Directory is a directory and myvirtualenv is the name of the virtual environment in use. On Windows replace bin with Scripts.

chitchcock /
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real