Skip to content

Instantly share code, notes, and snippets.

kijtra kijtra

View GitHub Profile
@kijtra
kijtra / template.html
Last active Mar 31, 2017
Pure CSS Admin Template skeleton (demo: https://codepen.io/kijtra/pen/MpZeGq )
View template.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Admin Template</title>
<link rel="stylesheet" href="template.css">
</head>
<body>
@kijtra
kijtra / user.sql
Last active Oct 28, 2016
User information store DB(MySQL) structure example
View user.sql
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL DEFAULT '',
`email` VARCHAR(100) NOT NULL DEFAULT '',
`password` CHAR(60) NOT NULL DEFAULT '', /* Use PHP's password_hash() */
`display_name` VARCHAR(191) NOT NULL DEFAULT '',
`url` VARCHAR(191) NOT NULL DEFAULT '',
`registered_at` DATETIME NULL DEFAULT NULL,
@kijtra
kijtra / .bashrc
Last active Oct 5, 2017
Bash color like Windows Git Bash
View .bashrc
function show_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/'
}
function show_colored_prompt {
local WHITE="\[\e[00m\]"
local GRAY="\[\e[1;30m\]"
local LIGHTGREEN="\[\e[1;32m\]"
local GREEN="\[\e[0;32m\]"
local PURPLE="\[\e[0;35m\]"
@kijtra
kijtra / numalpha.php
Last active Sep 10, 2016
#PHP Numeric to Alphabet OR Alphabet to Numeric function very simple
View numalpha.php
<?php
function numalpha($value) {
if (ctype_digit((string) $value)) {
return strtr(base_convert($value, 10, 36), '0123456789', 'ABCDEFGHIJ');
} elseif (ctype_alpha($value)) {
return base_convert(strtr($value, 'ABCDEFGHIJ', '0123456789'), 36, 10);
}
return false;
}
@kijtra
kijtra / google_maps_api-padding_bounds.js
Last active Jun 25, 2016
Get Paddinged Bounds for MapGoogle Maps API
View google_maps_api-padding_bounds.js
if (google && google.maps && !google.maps.Map.prototype.getPadBounds) {
google.maps.Map.prototype.getPadBounds = function (top, right, bottom, left) {
top = (('' + top).match(/^[0-9]+$/i) ? parseInt(top) : 0);
right = (('' + right).match(/^[0-9]+$/i) ? parseInt(right) : 0);
bottom = (('' + bottom).match(/^[0-9]+$/i) ? parseInt(bottom) : 0);
left = (('' + left).match(/^[0-9]+$/i) ? parseInt(left) : 0);
var bounds = this.getBounds();
var scale = Math.pow(2, this.getZoom());
var proj = this.getProjection();
@kijtra
kijtra / pref_ids.php
Created Jun 9, 2016
都道府県ID(pref)
View pref_ids.php
<?php
$pref_ids = array(
'01' => '北海道', '02' => '青森県', '03' => '岩手県', '04' => '宮城県', '05' => '秋田県',
'06' => '山形県', '07' => '福島県', '08' => '茨城県', '09' => '栃木県', '10' => '群馬県',
'11' => '埼玉県', '12' => '千葉県', '13' => '東京都', '14' => '神奈川県', '15' => '新潟県',
'16' => '富山県', '17' => '石川県', '18' => '福井県', '19' => '山梨県', '20' => '長野県',
'21' => '岐阜県', '22' => '静岡県', '23' => '愛知県', '24' => '三重県', '25' => '滋賀県',
'26' => '京都府', '27' => '大阪府', '28' => '兵庫県', '29' => '奈良県', '30' => '和歌山県',
'31' => '鳥取県', '32' => '島根県', '33' => '岡山県', '34' => '広島県', '35' => '山口県',
'36' => '徳島県', '37' => '香川県', '38' => '愛媛県', '39' => '高知県', '40' => '福岡県',
@kijtra
kijtra / depot.php
Last active Mar 19, 2016
#PHP simple flexible data container with ArrayObject
View depot.php
<?php
function depot()
{
static $container = null;
if (null === $container) {
$container = new \ArrayObject(array(), $flag);
}
$flag = \ArrayObject::ARRAY_AS_PROPS;
$args = func_get_args();
@kijtra
kijtra / meta_tag.php
Last active Mar 17, 2016
#PHP html meta-tag (OGP, FB app, Twitter Cards, etc) helper.
View meta_tag.php
<?php
function meta_tag()
{
static $buffer = array();
$charset = 'utf-8';
$num = func_num_args();
$args = func_get_args();
if (2 === $num && is_string($args[0]) && is_string($args[1])) {
@kijtra
kijtra / container.php
Last active Mar 11, 2016
#PHP Simple data container
View container.php
<?php
/*
// Usage
$container = new Container();
// Basic use
$container->aa = 'a';
// Its No error, and added hierarchical data.
@kijtra
kijtra / Reg.php
Last active Jan 14, 2016
#PHP preg_match Wrapper
View Reg.php
<?php
class Reg
{
private $source = null;
private $matched = false;
public function __construct($source)
{
$this->source = $source;
}
You can’t perform that action at this time.