This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('parse_query', 'date_base_permalink'); | |
function date_base_permalink($wp_query) { | |
$q = (object)$wp_query->query_vars; | |
if (!empty($q->year) && !empty($q->monthnum) && !empty($q->day) && !empty($q->minute) && !empty($q->hour)) { | |
$wp_query->is_single = true; | |
$wp_query->is_singular = true; | |
$wp_query->is_archive = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup | |
const {WebClient} = require("@slack/client"); | |
const web = new WebClient(token, {logLevel: "error"}); | |
web.users.list().then((response) => { | |
response.members.forEach((v, i) => { | |
// Slackの参加者にまつわる諸々 | |
}); | |
return web.channels.list(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test/foo.test.js | |
var should = require('should'); | |
function Foo() { | |
return { | |
hoge: function(val) { | |
if (val == '') { | |
throw new Error('fail'); | |
} | |
return val; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRegionName(ip) { | |
var cache = CacheService.getPublicCache(); | |
var cacheKey = "api:ip-api.com:" + ip; | |
var region = cache.get(cacheKey); | |
if (region == null) { | |
var geo = UrlFetchApp.fetch("http://ip-api.com/json/" + ip).getContentText(); | |
region = JSON.parse(geo).regionName; | |
cache.put(cacheKey, region, 60 * 60 * 8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
catch :loop do | |
foo.each do |onefoo| | |
bar.each do |onebar| | |
# いろいろ処理 | |
throw :loop if count > 5 | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=EUC-JP" /> | |
<script type="text/javascript" src="js/prototype.js"></script> | |
<script type="text/javascript"> | |
//<![CDATA[ | |
function addItem(){ | |
$('area1').innerHTML = "<div id='add1'>加えられました</div>"; | |
} | |
function changeStyle(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_fork do |server, worker| | |
ENV['BUNDLE_GEMFILE'] = "#{pj_root_dir}/current/Gemfile" | |
# The following is only recommended for memory/DB-constrained | |
# installations. It is not needed if your system can house | |
# twice as many worker_processes as you have configured. | |
# | |
# # This allows a new master process to incrementally | |
# # phase out the old master process with SIGTTOU to avoid a | |
# # thundering herd (especially in the "preload_app false" case) | |
# # when doing a transparent upgrade. The last worker spawned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function change_title_tag( $title ) { | |
//条件分岐タグ等を使ってページにより $title を変更する処理 | |
if (is_date()) { | |
$title = get_the_title($title) . " | " . get_bloginfo('name'); | |
} | |
return $title; | |
} | |
add_filter( 'pre_get_document_title', 'change_title_tag' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pHash = require("phash"); | |
var samples = [ | |
"samples/lena.jpg", | |
"samples/lena-small.jpg", | |
"samples/lena-sepia.jpg", | |
"samples/lena-mosaic.jpg", | |
"samples/lena-cut.jpg", | |
"samples/lena-cut2.jpg", | |
"samples/lena-horizonal-flip.jpg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// api.shop-pro.jp で表示された内容を設定 | |
var CLIENT_ID = '*****'; | |
var CLIENT_SECRET = '*****'; | |
function getOAuthService() { | |
return OAuth2.createService('colormeshop') | |
.setAuthorizationBaseUrl('https://api.shop-pro.jp/oauth/authorize') | |
.setTokenUrl('https://api.shop-pro.jp/oauth/token') | |
.setClientId(CLIENT_ID) | |
.setClientSecret(CLIENT_SECRET) |