Skip to content

Instantly share code, notes, and snippets.

View evandertino's full-sized avatar
🎧
In the zone

Evander Otieno evandertino

🎧
In the zone
  • Foursquare
  • Nairobi, Kenya
View GitHub Profile
@evandertino
evandertino / SchemaMigration.scala
Created January 7, 2021 07:45 — forked from izmailoff/SchemaMigration.scala
Liquibase for Scala
// Liquibase SBT dependency is something like this:
// "org.liquibase" % "liquibase-core" % "3.0.5"
import java.sql.Connection
import liquibase.Liquibase
import liquibase.resource.FileSystemResourceAccessor
import liquibase.database.DatabaseFactory
import liquibase.database.jvm.JdbcConnection
import liquibase.resource.ClassLoaderResourceAccessor
import net.liftweb.common.Logger
Transactors: Actors + STM
Actors are excellent for solving of problems where you have many independent processes
that can work in isolation and only interact with other Actors through message passing.
This model fits many problems. But the actor model is unfortunately a terrible model for
implementing truly shared state. E.g. when you need to have consensus and a stable view of
state across many components. The classic example is the bank account to clients to
deposits and withdrawals in which each operation needs to be atomic. For detailed
discussion on the topic see this JavaOne presentation:
http://www.slideshare.net/jboner/state-youre-doing-it-wrong-javaone-2009.
@evandertino
evandertino / custom-props.tsx
Created April 27, 2020 15:14 — forked from iamtmrobinson/custom-props.tsx
Using custom props with a Redux form in Typescript
import * as React from 'react';
import {
Field as FormField,
InjectedFormProps,
reduxForm,
} from 'redux-form';
interface CustomProps {
customText: string;
}
@evandertino
evandertino / mapOfIntergers.js
Created July 30, 2019 09:27
A function that given an array of integers, it return a map of integers that appear multiple times and the number of times it appears.
const mapOfIntergers = arrayOfInts => {
let results = {};
for (let i = 0; i < arrayOfInts.length; i++) {
let m = arrayOfInts[i];
let count = arrayOfInts.filter(dupInt => dupInt === m).length;
if (count > 1) results[m] = count;
}
return results;
};
@evandertino
evandertino / fetch-api-examples.md
Created September 28, 2018 20:48 — forked from justsml/fetch-api-examples.md
JavaScript Fetch API Examples
@evandertino
evandertino / README.md
Created September 22, 2018 06:56 — forked from JamesMenetrey/README.md
Install Oh-My-Zsh + iTerm2 with Solarized + System-wide console in 2017 (macOS)

Install iTerm2 with Solarized in 2017

Here is the looks and feel of your terminal once the tutorial has been applied on your system:

Install iTerm2

Using Homebrew:

Run powershell as administrator:
-posh-gvm installation:
Execute (new-object Net.WebClient).DownloadString('https://raw.githubusercontent.com/flofreud/posh-gvm/master/GetPoshGvm.ps1') | iex
Execute Import-Module posh-gvm
// if you have problems with execution policy (https://msdn.microsoft.com/powershell/reference/5.1/Microsoft.PowerShell.Core/about/about_Execution_Policies)
// Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
// later return to old value
Execute gvm help to get started!
-sdkman installation:
@evandertino
evandertino / gist:105daf54a319524975b45b9158b797d6
Last active August 15, 2016 08:20 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@evandertino
evandertino / GenerateSimplePdfReportWithJasperReports.java
Created August 3, 2016 09:33 — forked from rponte/GenerateSimplePdfReportWithJasperReports.java
Example on how to generate a simple pdf report with JasperReports
package rponte.report;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;