Skip to content

Instantly share code, notes, and snippets.

kijtra kijtra

Block or report user

Report or block kijtra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kijtra
kijtra / array_dot_access.php
Created Mar 18, 2014
ドットつなぎの文字列で連想配列にアクセスする関数 ref: http://qiita.com/kijtra/items/16dabc977d7a9079b8fb
View array_dot_access.php
<?php
function array_dot_access( $str = NULL ) {
if( empty($str) || !is_string($str) ) {
return false;
}
static $buffer=array();
if( !empty($buffer[$str]) ) {
@kijtra
kijtra / browser.js
Last active Aug 29, 2015
[JavaScript] UA detect
View browser.js
var $browser = (function(){
var ua = navigator.userAgent.toLowerCase(),
desktop = !/android|iphone|ipod|ipad|mobile|windows phone|blackberry|webos|meego/.test(ua),
b = {
ua: ua,
desktop: desktop,
mobile: !desktop,
android: /android/.test(ua),
ios: /iphone|ipod|ipad/.test(ua),
iphone: /iphone/.test(ua),
@kijtra
kijtra / jquery.textareaAutoHeigh.js
Created Jun 19, 2014
[JavaScript] テキストエリアの高さを自動調節するやつ
View jquery.textareaAutoHeigh.js
(function($){
var update = function(obj, min){
var br = obj.val().match(/(\r\n|\n)/gm);
if (br) {
if (br.length >= min) {
obj.prop('rows', br.length + 1);
}
} else {
obj.prop('rows', min);
}
@kijtra
kijtra / cipher.php
Last active Aug 29, 2015
[PHP] 簡易的な暗号化・複合両対応関数
View cipher.php
<?php
function cipher($string = null) {
if (empty($string) || !is_string($string)) {
return false;
}
static $key = null, $iv_size = null, $prefix = null;
$from = array('+', '/');
@kijtra
kijtra / jquery.checkers.js
Created Jul 30, 2014
<label> 内にある checkbox か radio がチェックされた時(または最初から checked の時)に <label> に「checked」というクラス名をつけるスニペット。
View jquery.checkers.js
(function(){
var radios = {};
$('label').each(function(){
var label = $(this),
input = label.find('input[type="checkbox"],input[type="radio"]').first();
if (!input.length) {
return false;
}
@kijtra
kijtra / linker.php
Created Aug 20, 2014
[PHP] テキスト内のURLをリンクにする関数
View linker.php
<?php
function linker($text = null ,$blank = false)
{
if (empty($text)) {
return null;
}
$text = preg_replace('/&apos;/', '&#39;', $text); // IE対策
@kijtra
kijtra / adsense_for_keitai.php
Created Oct 5, 2014
[PHP] 携帯(フィーチャーフォン/ガラケー)サイト用AdSenseのためのPHPクラス
View adsense_for_keitai.php
<?php
class adsenseForKeitai
{
private $ad_url = 'http://pagead2.googlesyndication.com/pagead/ads';
private $timeout = 3;//second
private $params = array(
'slot' => null,
'client' => null,//pub-...
@kijtra
kijtra / gooapi.php
Created Dec 4, 2014
[PHP] gooラボ( https://labs.goo.ne.jp/ )の文字列解析系API用のクラス(やっつけ)
View gooapi.php
<?php
/*
本番利用にはクレジット表記が必要なので注意
https://labs.goo.ne.jp/apiusage/
*/
class gooAPI
{
private $app_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
private $api_base = 'https://labs.goo.ne.jp/api/';
@kijtra
kijtra / vars.php
Last active Aug 29, 2015
#PHP 変数のSet/Get用関数
View vars.php
<?php
function vars($keys = null, $value = null)
{
static $values = array(), $buffer = array();
if (empty($keys)) {
return $values;
}
@kijtra
kijtra / geohash.php
Created May 14, 2015
[PHP] Geo Hash encode and decode function.
View geohash.php
<?php
function geohash($lat, $lon = NULL, $len = 12)
{
if ($len < 1 || $len > 12) {
return false;
}
$base32Chars = array(
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'b', 'c', 'd', 'e', 'f', 'g',
You can’t perform that action at this time.