Skip to content

Instantly share code, notes, and snippets.

View kohki-shikata's full-sized avatar

Kohki SHIKATA kohki-shikata

View GitHub Profile
@hissy
hissy / multilingual_text.php
Last active December 27, 2015 22:09
[concrete5] How to switch area name based on the current language. Install: upload multilingual_text.php to /helpers directory. Requires Internationalization add-on
<?php defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('section', 'multilingual');
class MultilingualTextHelper {
/**
* Takes area name string (like Header) and add language string (like Header Ja JP)
* @param string $text
* @return string
@yuka2py
yuka2py / modernizer.environ.js
Last active December 29, 2015 18:59
デバイスやブラウザを判定する Modernizr 用の追加テストです。 えっと…。いや、実務では要りますよ。やっぱり。今回まとめました。
(function() {
if (!window.Modernizr) {
return;
}
var ua = new String(window.navigator.userAgent.toLowerCase());
ua.has = function (cond) {
return this.indexOf(cond) != -1;
};
@jjmu15
jjmu15 / in_viewport.js
Created January 27, 2014 10:19
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@YuzuruSano
YuzuruSano / slack_feelgood.txt
Created November 18, 2015 07:22
slackで絵文字を並べていい感じに顔をつくる
ー   へ
:eye::nose::eye:
 ) :lips:(
@kanetei
kanetei / view.php
Last active April 5, 2016 05:28
[concrete5] オートナビの出力をページ属性の値でグルーピングする
<?php defined('C5_EXECUTE') or die("Access Denied.");
// application/blocks/autonav/templates/grouping_autonav/view.php
$navItems = $controller->getNavItems();
$c = Page::getCurrentPage();
function cmp($a, $b)
{
$cmp = strcmp($a->cObj->getAttribute('attribute'), $b->cObj->getAttribute('attribute'));
@mkamakura
mkamakura / firebase.json
Created December 17, 2017 03:35
[Firebase Hosting,Functions] basic認証付きでサイトを公開する
{
"hosting": {
"public": "public",
"rewrites": [
{
"source": "**",
"function": "app"
}
],
"redirects": [{