Skip to content

Instantly share code, notes, and snippets.

View toshimaru's full-sized avatar

Toshimaru toshimaru

View GitHub Profile
@toshimaru
toshimaru / gist:3486237
Created August 27, 2012 06:28
masking string
<?php
/**
* masking string
*
* @param string @secretStr
* @return string
*/
function masking($secretStr) {
return str_repeat('*', strlen($secretStr));
}
@toshimaru
toshimaru / gist:3495190
Created August 28, 2012 05:23
circle with css3
.circle {
background-color: #cc3;
height: 150px;
width: 150px;
border-radius:75px;
-moz-border-radius:75px;
-webkit-border-radius: 75px;
}
@toshimaru
toshimaru / gist:3639714
Created September 5, 2012 16:46
python クラス基礎
# http://d.hatena.ne.jp/kakurasan/20080414/p1
#! /usr/bin/python
# -*- encoding: utf-8 -*-
a = 1
class TestClass:
a = 10 # メンバ関数からは「self.a」で扱われる
def __init__(self):
"""オブジェクトの初期化処理・コンストラクタとも"""
@toshimaru
toshimaru / orderFade.js
Created September 19, 2012 05:26
jQuery order fadeIn function
function orderFade() {
$("div:hidden:first").fadeIn('fast', function () {
orderFade()
});
}
orderFade();
@toshimaru
toshimaru / php_beautifier.sh
Last active October 10, 2015 21:28
php_beautifier command
php_beautifier --filters "ArrayNested NewLines(before=if:switch:T_COMMENT)" -f filename.php
@toshimaru
toshimaru / gist:3756569
Created September 20, 2012 15:23
get tweets
// see. http://blog.asial.co.jp/659
<script type="text/javascript">
/**
* コールバック
*/
function myfunc(json) {
var box = $('#twitterBox');
$(json.results).each(function(i, v) {
v.jp_created_at = dateJp(v.created_at);
@toshimaru
toshimaru / gist:3775127
Created September 24, 2012 09:34
urlsafe base64 function.
<?php
function base64_urlsafe_encode($val) {
$val = base64_encode($val);
return str_replace(array('+', '/', '='), array('_', '-', '.'), $val);
}
function base64_urlsafe_decode($val) {
$val = str_replace(array('_','-', '.'), array('+', '/', '='), $val);
return base64_decode($val);
@toshimaru
toshimaru / gist:3793104
Created September 27, 2012 09:28
Hatena Engineer Seminar メモ
@toshimaru
toshimaru / http_response_code.php
Created October 25, 2012 11:35
own http_response_code method
<?php
/**
* if there is no http_response_code function (PHP 5 >= 5.4)
* define own http_response_code function.
* refs. http://www.php.net/manual/ja/function.http-response-code.php#107261
*/
if (!function_exists('http_response_code')) {
/**
* @param string $code http response code
*/
@toshimaru
toshimaru / gist:3978567
Created October 30, 2012 06:04
array_merge VS plus
<?php
$ary1 = array(
'matsu' => 'ary1 matsu',
'take' => 'ary1 take',
'ume' => 'ary1 ume',
'ary1' => 'ary1 value',
);