Skip to content

Instantly share code, notes, and snippets.

David Francoeur daddykotex

Block or report user

Report or block daddykotex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@daddykotex
daddykotex / DoobieComposite.scala
Created Nov 20, 2017
If you have a SQL column that allows NULL but you want to fallback to a default rather than using an `Option[T]`, you can define your own composite like that. This is probably nota good way to do it but it works and avoid the throwing of `NonNullableColumnRead`
View DoobieComposite.scala
import java.sql.{ResultSet, PreparedStatement}
import doobie.enum.nullability.Nullable
import doobie.imports._
import doobie.util.meta
import doobie.util.meta.Meta
import doobie.util.kernel.Kernel
sealed trait LoginWay {
import LoginWay._
@daddykotex
daddykotex / variable-python-decorators.py
Last active Jul 18, 2017
Use an existing python decorator with variable parameters
View variable-python-decorators.py
#
# pip install tenacity
# Usage:
# → py variable-python-decorators.py 4
# The given maximum attempt number is 4
# We want this function to be retried 5 times
# We want this function to be retried 5 times
# We want this function to be retried 5 times
# We want this function to be retried 5 times
# We want this function to be retried 5 times
@daddykotex
daddykotex / update-wordpress.sh
Created Oct 17, 2016
Update wordpress via shell access (3.1+)
View update-wordpress.sh
#!/bin/bash
set -ex
# Update wordpress to a specific version. This script should work with versions above 3.1
# If you provide a LANG_CODE. It will be used to the appropriate Wordpress package.
# LANG_CODE examples: fr_CA, pt_BR, es_ES
# See WP supported languages here: https://codex.wordpress.org/Installing_WordPress_in_Your_Language#Manually_Installing_Language_Files
# See extended WP procedures here: https://codex.wordpress.org/Upgrading_WordPress_Extended
View keybase.md

Keybase proof

I hereby claim:

  • I am daddykotex on github.
  • I am daddykotex (https://keybase.io/daddykotex) on keybase.
  • I have a public key ASDZYqHaKPAmTw84LVasQbF3XFK3QMaNH9NLJxTBstuRpAo

To claim this, I am signing this object:

@daddykotex
daddykotex / DummyAndroidSpringRestTemplateApiTest.java
Created Mar 17, 2015
Test your Spring Rest Template APIs with the new Android Unit testing that requires mocking
View DummyAndroidSpringRestTemplateApiTest.java
package com.mnubo.platform.android.sdk.internal;
import android.util.Log;
import org.apache.http.conn.params.ConnManagerParams;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.AbstractHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
@daddykotex
daddykotex / DummyAndroidTextUtilsMockTest.java
Last active Apr 20, 2017
Mock Android TextUtils static method
View DummyAndroidTextUtilsMockTest.java
import android.text.TextUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
You can’t perform that action at this time.