Skip to content

Instantly share code, notes, and snippets.

View gurasa's full-sized avatar

Akira Miura gurasa

View GitHub Profile
@gurasa
gurasa / function-escape_html.coffee
Created June 30, 2016 03:20
JS で HTML エスケープする
escape_html = (string) ->
if typeof string != 'string'
return string
string.replace /[&'`"<>]/g, (match) ->
{
'&': '&amp;'
'\'': '&#x27;'
'`': '&#x60;'
'"': '&quot;'
'<': '&lt;'
@gurasa
gurasa / disable_visual_editor_in_page_template.php
Last active June 16, 2016 03:46
WordPress の特定のカスタムページテンプレートだけ、管理画面でビジュアルエディタ(リッチエディタ)を非表示にする方法
<?php
// 特定のカスタムページテンプレートだけ、管理画面でビジュアルエディタ(リッチエディタ)を非表示
function disable_visual_editor_in_page_template(){
global $typenow;
$template_name = basename( get_page_template_slug( $_GET['post'] ), '.php' );
if( $typenow == 'page' and $template_name == 'TEMPLATE_NAME' ){
add_filter('user_can_richedit', create_function('' , 'return false;') );
}
}
add_action( 'load-post.php', 'disable_visual_editor_in_page_template' );
@gurasa
gurasa / is_home.php
Created October 6, 2015 04:23
現在のページがHOMEかそうでないかの判定処理PHP
<?php
$uri = $_SERVER["REQUEST_URI"];
$is_home = $uri == '/' || $uri == '/index.html';
// var_dump($is_home);
?>
###
# Class.Canvas
###
class Class.Canvas
constructor: (options)->
# Variables
@items = []
@fps = 30
@itemIncrement = 0
# Context initialize
###
# Class.Canvas
###
class Class.Canvas
constructor: (options)->
# Variables
@items = []
@fps = 30
# Context initialize
until options? then return false
@gurasa
gurasa / _.lib.sass
Created December 19, 2013 01:34
sass で色々作るときの mixin ライブラリ
// デバッグ用
@mixin area
background: rgba(255,0,0,0.5)
// 座標指定
@mixin pos($top,$left)
position:absolute
top: #{$top}px
left: #{$left}px
@mixin pos_tl($top,$left)
position:absolute
@gurasa
gurasa / base.html
Last active December 31, 2015 19:19
スマホも見据えたHTML5の基本構造
<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width">
<meta name="description" content="">
<meta name="keywords" content="">
<title></title>
<!-- styles -->
@gurasa
gurasa / mainLoop.coffee
Last active December 17, 2015 20:39
色んなものに使えるループ
mainLoop =
initialize: ->
@currentTime = @getTime
@lastTime = @currentTime
vendors = ["ms", "moz", "webkit", "o"]
x = 0
while x < vendors.length and not window.requestAnimationFrame
window.requestAnimationFrame = window[vendors[x] + "RequestAnimationFrame"]