Skip to content

Instantly share code, notes, and snippets.

View jokamjohn's full-sized avatar
🏠
Working from home

John Kagga jokamjohn

🏠
Working from home
View GitHub Profile
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
try {
// Construct the URL for the OpenWeatherMap query
// Use this in your testLocationTable() method
// Test data we're going to insert into the DB to see if it works.
String testLocationSetting = "99705";
String testCityName = "North Pole";
double testLatitude = 64.7488;
double testLongitude = -147.353;
@jokamjohn
jokamjohn / Error
Created March 30, 2015 20:27
Have failed to create table
03-30 18:55:02.112 2156-2156/com.example.android.database I/art﹕ Late-enabling -Xcheck:jni
03-30 18:55:04.163 2156-2156/com.example.android.database E/SQLiteLog﹕ (1) near "TABLETEMPERATURES": syntax error
03-30 18:55:04.257 2156-2156/com.example.android.database D/AndroidRuntime﹕ Shutting down VM
03-30 18:55:04.302 2156-2156/com.example.android.database E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.android.database, PID: 2156
java.lang.RuntimeException: Unable to resume activity {com.example.android.database/com.example.android.database.Ui.MainActivity}: android.database.sqlite.SQLiteException: near "TABLETEMPERATURES": syntax error (code 1): , while compiling: CREATE TABLETEMPERATURES (_IDINTEGER PRIMARY KEYTEMPERATUREREAL)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2951)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2982)
at android.app.ActivityThread.handleLaunchActivity(ActivityThre
@jokamjohn
jokamjohn / android.md
Last active August 29, 2015 14:22 — forked from geekygecko/android.md

Android Cheat Sheet

Developer tips

Record a video of your app

Developer options -> Check show touches
adb shell screenrecord /sdcard/video.mp4
adb pull /sdcard/video.mp4
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
Google Apps for Android 4.2 (https://www.androidfilehost.com/?fid=23060877490000128 - gapps-jb-20130812-signed.zip)
Google Apps for Android 4.1 (https://www.androidfilehost.com/?fid=22979706399755082 - gapps-jb-20121011-signed.zip)
@jokamjohn
jokamjohn / gallerycode.html
Created July 7, 2015 11:09
motorhub gallery
<div id="cp_widget_804025a2-a11d-41c1-973e-4703faf30815">...</div><script type="text/javascript">
var cpo = []; cpo["_object"] ="cp_widget_804025a2-a11d-41c1-973e-4703faf30815"; cpo["_fid"] = "AoFApvMyGdKk";
var _cpmp = _cpmp || []; _cpmp.push(cpo);
(function() { var cp = document.createElement("script"); cp.type = "text/javascript";
cp.async = true; cp.src = "//www.cincopa.com/media-platform/runtime/libasync.js";
var c = document.getElementsByTagName("script")[0];
c.parentNode.insertBefore(cp, c); })(); </script><noscript>Powered by Cincopa <a href='http://www.cincopa.com/video-hosting'>Video Hosting for Business</a> solution.<span>Motorhub Gallery</span><span>Cruz</span><span>Next year</span><span>originaldate</span><span> 1/1/0001 6:00:00 AM</span><span>width</span><span> 700</span><span>height</span><span> 420</span><span>ferrari</span><span>next year</span><span>originaldate</span><span> 1/1/0001 6:00:00 AM</span><span>width</span><span> 700</span><span>height</span><s
@jokamjohn
jokamjohn / _ide_helper.php
Last active August 29, 2015 14:26 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.1.1 (LTS) on 2015-06-11.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@jokamjohn
jokamjohn / install.sh
Last active August 29, 2015 14:27 — forked from fideloper/install.sh
Vagrant Provisioning Script for PHP applications. This installs a LAMP stack.
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@jokamjohn
jokamjohn / web.config
Last active September 15, 2015 14:54 — forked from allebb/web.config
Laravel 5.x web.config file for Windows Azure hosting
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
</staticContent>
public function postLogin(Request $request)
{
//dd( $this->getCredentials($request) );
$authenticated = false;
$this->validate($request, [
$this->loginUsername() => 'required',
'password' => 'required'
]);