Skip to content

Instantly share code, notes, and snippets.

@JaniKibichi
JaniKibichi / hhvmDockerfile
Created June 17, 2017 18:56
ussd-hhvm-dockerfile
#choose base image
FROM ubuntu:16.04
#update base image
RUN apt-get update && apt-get -y upgrade
#install hhvm
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
RUN deb http://dl.hhvm.com/debian jessie main | tee /etc/apt/sources.list.d/hhvm.list
RUN apt-get update && apt-get -y install hhvm
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@JaniKibichi
JaniKibichi / MathGame_GameActivity.java
Created September 18, 2017 08:23
Code for GameActivity with setQuestion, updateScoreAndLevel and isCorrect methods.
package com.mjuaji.mathgame1155;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
@JaniKibichi
JaniKibichi / MathGame_MainActivity.java
Created September 18, 2017 08:32
Code for MainActivity
package com.mjuaji.mathgame1155;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
@JaniKibichi
JaniKibichi / MemoryGame_activity_main.xml
Last active January 27, 2022 10:43
Memory Game activity_main xml file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mjuaji.memorygame2308.MainActivity">
<LinearLayout
android:layout_width="368dp"
@JaniKibichi
JaniKibichi / MemoryGame_activity_game.xml
Created September 22, 2017 07:06
Memory Game activity_game xml file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mjuaji.memorygame2308.GameActivity"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
@JaniKibichi
JaniKibichi / MemoryGame_wobble.xml
Created September 22, 2017 07:09
Memory Game - wobble.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="100"
android:fromDegrees="-5"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="3"
android:repeatMode="reverse"
android:toDegrees="5" />
@JaniKibichi
JaniKibichi / MemoryGame_MainActivity.java
Created September 22, 2017 07:12
MemoryGame Main Activity File
package com.mjuaji.memorygame2308;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
@JaniKibichi
JaniKibichi / MemoryGame_GameActivity.java
Created September 22, 2017 07:14
MemoryGame Game activity File
package com.mjuaji.memorygame2308;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.os.Handler;
@JaniKibichi
JaniKibichi / ussdsms.php
Last active January 27, 2022 10:42
ussd + sms API integration
<?php
//in case you are connecting to a database
require_once('dbConnector.php');
//include the Africa's Talking Library
require_once('AfricasTalkingGateway.php');
//include a config file with your API Key and username etc.
require_once('config.php');
// Reads the variables sent via POST from our gateway
$sessionId = $_POST["sessionId"];