Skip to content

Instantly share code, notes, and snippets.

View kangwa's full-sized avatar

Kangwa Bwali kangwa

  • Johannesburg South Africa
View GitHub Profile
@kangwa
kangwa / Makefile
Created March 22, 2019 09:31
Elixir TDLib OSX MakeFile
BUILD_ROOT=_build/tdlib
BUILD_DIRECTORY=$(BUILD_ROOT)/rel
BUILD_ARTIFACT=$(BUILD_DIRECTORY)/bin/tdlib_json_cli
PRIV_DIR=priv
BIN_TARGET=$(PRIV_DIR)/tdlib-json-cli
JOBS=2
VERBOSE=0
TDLIB_SRC=priv/tdlib_v1.1.1.tar.gz
@kangwa
kangwa / zambia_mobile_number_regex.js
Last active September 21, 2020 12:33
Zambian Mobile Number Regex
/^09(5|6|7){1}[0-9]{7}$/.text("09550123456")
# This tests for MTN, Cell Z, and Airtel numbers
...
dependencies {
compile 'com.facebook.android:account-kit-sdk:4.23.0'
}
...
...
<uses-permission android:name="android.permission.INTERNET"/>
...
<meta-data android:name="com.facebook.accountkit.ApplicationName" android:value="@string/app_name" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/FACEBOOK_APP_ID" />
<meta-data android:name="com.facebook.accountkit.ClientToken" android:value="@string/ACCOUNT_KIT_CLIENT_TOKEN" />
...
<activity android:name="com.facebook.accountkit.ui.AccountKitActivity" />
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Nativescript AccountKit</string>
<string name="title_activity_kimera">NativeScript AccountKit</string>
<string name="FACEBOOK_APP_ID">YOUR_APP_ID_HERE</string>
<string name="ACCOUNT_KIT_CLIENT_TOKEN">YOUR_TOKEN_HERE</string>
</resources>
@kangwa
kangwa / activity-result.js
Created January 3, 2018 01:17
NativeScript AccountKit ActivityResult
var activity = app.android.foregroundActivity || app.android.startActivity;
var APP_REQUEST_CODE = appSettings.getNumber("APP_REQUEST_CODE");
activity.onActivityResult = function (requestCode, resultCode, data) {
if (requestCode === APP_REQUEST_CODE) {
var loginResult = data.getParcelableExtra(com.facebook.accountkit.AccountKitLoginResult.RESULT_KEY);
if (loginResult.getError() != null) {
@kangwa
kangwa / viewmodel.js
Created January 3, 2018 00:52
NativeScript AccountKit ViewModel
function createViewModel() {
var viewModel = new Observable();
viewModel.phoneLogin = function () {
var phoneLoginType = com.facebook.accountkit.ui.LoginType.PHONE;
accountKitLogin(phoneLoginType)
}
viewModel.emailLogin = function () {
var emailLoginType = com.facebook.accountkit.ui.LoginType.EMAIL;
@kangwa
kangwa / account kit-login.js
Created January 3, 2018 00:42
Nativescript AccountKit Login
function accountKitLogin(loginType) {
var accountKitConfig = com.facebook.accountkit.ui.AccountKitConfiguration;
var intent = new android.content.Intent(activity, accountKitActivity.class);
var configBuilder = new accountKitConfig.AccountKitConfigurationBuilder(loginType, accountKitActivity.ResponseType.CODE);
intent.putExtra(
com.facebook.accountkit.ui.AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
configBuilder.build()
)
@kangwa
kangwa / .coveragerc
Created January 19, 2017 13:27
Django coverage.py config / settings
[run]
omit =
env/*
timetracker/*
*manage.py*
*urls.py*
*__init__.py*
*tests.py*
*apps.py*
@kangwa
kangwa / gist:dc0d6ad6bd69fd669180681569148c57
Created August 16, 2016 21:16
Post prospector results to slack
curl -X POST --data-urlencode 'payload={"channel": "#amari", "username": "webhookbot", "text": "'"$(prospector --strictness high)"'", "icon_emoji": ":ghost:"}' http://example.com