Skip to content

Instantly share code, notes, and snippets.

View leonguyen's full-sized avatar

Nam Nguyen leonguyen

View GitHub Profile
@leonguyen
leonguyen / gist:5251416
Last active December 15, 2015 11:09
CodeIgniter Lab: htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
@leonguyen
leonguyen / gist:5301102
Last active December 15, 2015 18:09
Android Lab: Hello World
//www.leonguyen.com
package com.example.androidlab;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
@leonguyen
leonguyen / gist:5308746
Last active December 15, 2015 19:09
Android Lab: Linear Layout - Defining an XML Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@leonguyen
leonguyen / gist:5309283
Last active December 15, 2015 19:09
Android Lab: Relative Layout - Defining an XML Layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
@leonguyen
leonguyen / gist:5315988
Last active December 15, 2015 20:08
CodeIgniter Lab: Config autoload.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
@leonguyen
leonguyen / gist:5315997
Created April 5, 2013 01:50
CodeIgniter Lab: Config config.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
@leonguyen
leonguyen / gist:5316010
Created April 5, 2013 01:52
CodeIgniter Lab: Config database.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
@leonguyen
leonguyen / gist:5325407
Last active December 15, 2015 21:28
Android Lab: Linear Layout - Message - Defining an XML Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/editTextTo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@leonguyen
leonguyen / gist:5325424
Last active December 15, 2015 21:28
Android Lab: Linear Layout - Quiz - Defining an XML Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="@+id/textView01"
android:layout_width="match_parent"
@leonguyen
leonguyen / gist:5325475
Last active December 15, 2015 21:28
Android Lab: Relative Layout - Reminder - Defining an XML Layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/editTextName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Reminder name" />