Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Zip code
*/
add_filter('usces_filter_after_zipcode', 'my_usces_filter_after_zipcode', 10, 2);
function my_usces_filter_after_zipcode($zip, $applyform) {
if ($applyform === 'JP') {
$zip = '000-0000';
}
return $zip;
function separateText($parent, tagName) {
$parent.children().addBack().contents().each(function() {
if (this.nodeType == 3) {
$(this).replaceWith($(this).text().replace(/(\S)/g, '<'+tagName+'>$1</'+tagName+'>'));
}
});
}
/**
* Copy
* Don't use for input tags
*
* e.g.
* <span id="copy-target">Copied text</span>
* <button class="copy-button" data-target="#copy-target">Copy</button>
*/
$('.copy-button').on('click', function (e) {
e.preventDefault();
// ex. $sp-width: 768px
@import 'param';
.entry-block {
/**
* Hyeading
*/
h2, h3, h4, h5, h6 {
margin: 1.4em 0 .5em;
font-weight: bold;
<?php
// Convert Movie URL
function getMovieUrl($movieUrl)
{
// Convert YouTube Url
if (
strpos($movieUrl, 'youtu.be') !== false ||
strpos($movieUrl, 'youtube.com/watch') !== false
) {
@sushat4692
sushat4692 / drop_files.js
Last active August 29, 2015 14:13
Local File Drag to Browser
( function( global, U ) {
"use strict";
// 必要条件に満たしていなければ終了
if (
! Element.prototype.addEventListener ||
! document.querySelector
) {
return;
}
@sushat4692
sushat4692 / admin-media.js
Last active August 29, 2015 14:09
WordPress CustomFIeld MediaUpload
/**
* admin-media.js
*
* @author SUSH <sush@sus-happy.ner>
*/
( function( $, U ) {
$( function() {
var target = $( '.custom-media' );
// 対象要素がなければ終了
@sushat4692
sushat4692 / twilio_send_sms.php
Created June 14, 2014 07:57
Twilio API used PHP Libraly
<?php
$to = '09012345678'; // 送信先
// ログイン後のダッシュボードに記載されている情報を入れる
$user_id = 'dummy_user_id';
$auth_token = 'dummy_auth_token';
// Twilioで購入した番号を入力
$from = '+18*********';
@sushat4692
sushat4692 / HHVMrun2.sh
Created May 15, 2014 12:19
HHVM setting LOCALE
$ export LC_ALL=C
$ hhvm --mode daemon -vServer.Type=fastcgi -vServer.Port=9000
@sushat4692
sushat4692 / nginx.conf
Created May 15, 2014 12:09
Nginx Config file for HHVM Fastcgi
# ...
upstream php-backend {
# server unix:/path/to/php-fpm.socket; php-fpmの場合
# server unix:/var/run/hhvm/sock; socket経由だと何故か動かず…
server 127.0.0.1:9000;
}
# ...