Skip to content

Instantly share code, notes, and snippets.

View dexterogieosahon's full-sized avatar

Dexter Ogie-osahon dexterogieosahon

View GitHub Profile
@dexterogieosahon
dexterogieosahon / variousCountryListFormats.js
Created April 12, 2020 06:12 — forked from incredimike/variousCountryListFormats.js
Country list as javascript array (alphabetical)
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: Nov 15, 2019
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
// List of all countries in a simple list / array.
@dexterogieosahon
dexterogieosahon / variousCountryListFormats.js
Created April 12, 2020 06:12 — forked from incredimike/variousCountryListFormats.js
Country list as javascript array (alphabetical)
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: Nov 15, 2019
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
// List of all countries in a simple list / array.
@dexterogieosahon
dexterogieosahon / curl.md
Created February 12, 2018 20:54 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@dexterogieosahon
dexterogieosahon / 01-activerecord.rb
Created February 3, 2017 02:51 — forked from janko/01-activerecord.rb
PostgreSQL JSON querying in Sequel (my presentation from our local Ruby meetup)
require "active_record"
ActiveRecord::Base.establish_connection('postgres:///testing')
ActiveRecord::Migration.verbose = false
ActiveRecord::Migration.class_eval do
create_table :played_quizzes, force: true do |t|
t.integer :player_ids, array: true
t.json :quiz_snapshot
end
@dexterogieosahon
dexterogieosahon / ImagePicker.java
Created January 11, 2017 19:40 — forked from Mariovc/ ImagePicker.java
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
@dexterogieosahon
dexterogieosahon / PreferencesManager.java
Created January 11, 2017 19:40 — forked from Mariovc/PreferencesManager.java
[Android] Manager to store data in SharedPreferences
import android.content.Context;
import android.content.SharedPreferences;
import com.google.gson.Gson;
/**
* Author: Mario Velasco Casquero
* Date: 30/09/2015
* Email: m3ario@gmail.com
*/
@dexterogieosahon
dexterogieosahon / ImagePickerWithCrop.java
Created January 11, 2017 19:40 — forked from Mariovc/ImagePickerWithCrop.java
[Android] Advanced utility for picking an image from Gallery/Camera with Android Intents (Crop included)
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
@dexterogieosahon
dexterogieosahon / AspectRatioImageView.java
Created January 11, 2017 19:40 — forked from JakeWharton/AspectRatioImageView.java
ImageView that respects an aspect ratio applied to a specific measurement.
// Copyright 2012 Square, Inc.
package com.squareup.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/** Maintains an aspect ratio based on either width or height. Disabled by default. */
public class AspectRatioImageView extends ImageView {
@dexterogieosahon
dexterogieosahon / ShareUtils.java
Created January 11, 2017 19:39 — forked from Mariovc/ShareUtils.java
Utility to share text and url on Facebook, Twitter and Whatsapp
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
@dexterogieosahon
dexterogieosahon / Log.java
Created January 11, 2017 19:39 — forked from Mariovc/Log.java
Android Log class improving the original class to do not log when it is on production and without tag needed
import com.antena3.floox.BuildConfig;
/**
* Author: Mario Velasco Casquero
* Date: 27/08/2015
*/
public class Log {
private static final int MAX_LOG_TAG_LENGTH = 23;
private static final boolean logsAllowed = BuildConfig.DEBUG;