Skip to content

Instantly share code, notes, and snippets.

View eimg's full-sized avatar

Ei Maung eimg

View GitHub Profile
@eimg
eimg / php-in-html.php
Created May 30, 2012 08:46
Embedded PHP in HTML document.
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>PHP Template</title>
</head>
<body>
<h1>Countries</h1>
<table>
<tr>
@eimg
eimg / php-template.php
Created May 30, 2012 08:49
Template style with PHP short open tags.
<?php
$countries = array(
array('iso'=>'AS', 'name'=>'American Samoa', 'iso3'=>'ASM'),
array('iso'=>'AD', 'name'=>'Andorra', 'iso3'=>'AND'),
array('iso'=>'AO', 'name'=>'Angola', 'iso3'=>'AGO'),
array('iso'=>'AG', 'name'=>'Antigua and Barbuda', 'iso3'=>'ATG'),
array('iso'=>'AR', 'name'=>'Argentina', 'iso3'=>'ARG'),
array('iso'=>'AM', 'name'=>'Armenia', 'iso3'=>'ARM'),
array('iso'=>'AT', 'name'=>'Austria', 'iso3'=>'AUT'),
array('iso'=>'AZ', 'name'=>'Azerbaijan', 'iso3'=>'AZE'),
@eimg
eimg / javascript.html
Created May 30, 2012 08:54
Creating content with Javascript
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Javascript Template</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function() {
var countries = [
@eimg
eimg / javascript-tmpl.html
Created May 30, 2012 09:00
Creating content with Javascript. Using jQuery Template.
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Javascript Template</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script>
@eimg
eimg / mmstrlen.php
Created May 31, 2012 12:03
Count no. of syllabes in a Myanmar Unicode string.
<?php
function mmstrlen($str) {
$standalones = array("ဤ", "၍", "ဪ", "၏", "၊", "။", "၌");
$consonants = array("က", "ခ", "ဂ", "ဃ", "င", "စ", "ဆ", "ဇ", "ဈ", "ည", "ဍ", "ဌ", "ဋ", "ဎ", "ဏ", "တ", "ထ", "ဒ", "ဓ", "န", "ပ", "ဖ", "ဗ", "ဘ", "မ", "ယ", "ရ", "လ", "ဝ", "သ", "ဟ", "ဠ", "အ");
$numbers = array("၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉");
$len = mb_strlen($str, "UTF-8");
$count = 0;
for($i = 0; $i < $len; $i++) {
@eimg
eimg / mmwrap.html
Created June 15, 2012 10:50
Inserting ZWSP between every syllables for better text wrapping for Myanmar text.
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Break Wrap</title>
<style>
body {
background: #efefdd;
}
@eimg
eimg / pdo-wrapper.php
Last active November 29, 2022 11:20
Simple yet secure PHP PDO database wrapper with CRUD methods...
<?php
# PDO Wrapper, supporting MySQL and Sqlite
# Usage:
# $db = new db();
#
# // table, data
# $db->create('users', array(
# 'fname' => 'john',
# 'lname' => 'doe'
# ));
@eimg
eimg / bb-todo-app.js
Created August 29, 2013 04:08
app.js from eimg/bb-todo
var app = {};
// Model
app.Todo = Backbone.Model.extend({
defaults: {
title: '',
done: false
},
toggle: function() {
@eimg
eimg / bb-todo-todo.html
Created August 29, 2013 04:12
todo.html from eimg/bb-todo
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Backbone Todo</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section id="app">
<html ng-app="ngSlides">
<head>
<script src="js/angular.min.js"></script>
<script src="js/ngSlides.js"></script>
</head>
<body>
<div ng-controller="SlideController">
<div class="slide {{slide.state}}"
ng-repeat="slide in slides" id="slide-{{$index}}">