Skip to content

Instantly share code, notes, and snippets.

View k4zuki02h4t4's full-sized avatar
🏠
家で働く

KAZUKI Otsuhata k4zuki02h4t4

🏠
家で働く
View GitHub Profile
@k4zuki02h4t4
k4zuki02h4t4 / escape.js
Last active August 29, 2015 14:21
JavaScript escape HTML.
var escapeQuotHTML = function(str){
return str.replace(/&/g,'&amp;').replace(/"/g, '&quot;').replace(/\'/g, '&apos;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
};
var escapeHTML = function(str){
var div = document.createElement('div');
var text = document.createTextNode(str);
div.appendChild(text);
return div.innerHTML;
jQuery(function($) {
"use strict";
var jqxhr;
var cbmCommentLike = {
get: function(postID){
var defer = $.Deferred();
$.ajax({
type: 'POST',
(function (window) {
var hoverClass = "";
var tapClass = "";
var trigger = "";
var action = {};
if (Modernizr.touch){
action = {
"start":"touchstart",
"end": "touchend"
@k4zuki02h4t4
k4zuki02h4t4 / functions.php
Last active February 9, 2016 23:44
Building a WordPress Theme with Foundation 5 workshop !
<?php
/**
* DNS prefetch.
*
* @return string
*
* @since Your theme name 1.0.0
*/
function your_themename_dns_prefetch() {
$dns = array(
@k4zuki02h4t4
k4zuki02h4t4 / genericons.php
Created July 29, 2015 19:28
Genericons PHP array.
<?php
if ( !function_exists( 'val_genericons' ) ) :
function val_genericons() {
return array(
'genericon-standard' => 'Standard',
'genericon-aside' => 'Aside',
'genericon-image' => 'Image',
'genericon-gallery' => 'Gallery',
'genericon-video' => 'Video',
'genericon-status' => 'Status',
@k4zuki02h4t4
k4zuki02h4t4 / font_awesome.php
Created July 29, 2015 19:30
Font Awesome PHP Array.
<?php
if ( !function_exists( 'val_fontawesome' ) ):
function val_fontawesome() {
return array(
'fa-adjust' => 'Adjust',
'fa-adn' => 'Adn',
'fa-align-center' => 'Align center',
'fa-align-justify' => 'Align justify',
'fa-align-left' => 'Align left',
'fa-align-right' => 'Align right',
@k4zuki02h4t4
k4zuki02h4t4 / pulugin-va-check-old-password.php
Last active August 29, 2015 14:27
Confirm old password before changing to new password with WordPress.
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Plugin Name: VA Check Old Password
* Plugin URI: http://visualive.jp/
* Description: This is a WordPress plugin that confirm old password before changing to new password.
* Author: KUCKLU
* Version: 1.0.0
* Author URI: http://visualive.jp/
* Text Domain: va-check-old-password
@k4zuki02h4t4
k4zuki02h4t4 / functions.php
Created September 15, 2015 12:32
WordPress - Category to a select box in meta box.
<?php
function override_register_category() {
$c_args = json_decode( json_encode( get_taxonomy( 'category' ) ), true );
$c_args['meta_box_cb'] = 'change_category_meta_box';
register_taxonomy( 'category', 'post', $c_args );
}
add_action( 'init', 'override_register_category' );
function change_category_meta_box( $post, $box ) {
if ( !isset( $box['args'] ) || !is_array( $box['args'] ) ) {
<?php
/**
* Return the post's parent's post_ID.
*
* @param int $post_id
* @return int|false
*/
function get_parent_id( $post_id ) {
$parent_id = wp_get_post_parent_id( $post_id );
@k4zuki02h4t4
k4zuki02h4t4 / gist:584d91e79481689aca8c
Last active November 12, 2018 19:55 — forked from ColemanCollins/gist:6144525fcb3eda615a60
Change Twitter’s Heart Animation to Exploding Namahage.
.HeartAnimationContainer .HeartAnimation {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAC1QAAABkCAMAAAAM7mAaAAAC+lBMVEUAAABpYXPIkOsAAAAAAAAAAAACAADIhOoIBgYCAQAAAAAAAAAAAADNj/UAAADJoYMAAACWysbMj/bLkvTHuaoAAADMkPbNj/bMkfX+uDagycUAAAAAAAAAAAAFBQW0nesCAQCm2rDMTqXeN2DMkPXMj/ai6Lj0t1ztunDFkPaovvrgLkXLYLwAAAACAQCCrvHQoPfZlM7N1Jee2cej1NWW2en4uj3Mk/X1uTD/qzPFY8rXf77gLkXRacL0jqeV0feXuubQleaf4s/WbMFkm+Ww9pqeMOLSjrTovpGU5sG0w8XexIP/sjTdRoiV2rGMZijkLkf/NlDgoJ6gx/iSICwzn++/VNaX5sKY1+maZR6pTta26JPTnMnJx6HJrMWioqLqqmfoL0hynd/B6pDhKkuclsbtpjBXo+Kf5MDd11f/rTOJlvOgZ8zdRoj7wzar5JU8oO3L6oy8vNyps77eRojsl6XimKZYwZzGuovVm8+iNd/nvI8+x5bTasC306MqGwhFx5OfNeLaesuTwI0yn+/gLEakn75CrNo7yY2fT9bqykQqyo3/tTX/sDSblPNlm+vor5fLxJa9rPq4LThkQRONjY3qqmczr+J/f3+MHSvSliyYJC53ThipcCL/NU/qqDIkGAfMjvUAAADUar/dRojdLkT/NU/bK0PuMkn7M033M0znMEfzMUvrMEjfL0TjMEZNEBjSK0DEKDwoCAziJkgJAgLcJEX/tDT/O1XNJz3/wzj/zTyR0vqgIDLXIEM4DBH/rTOHHCl8fHyxJDarDCW8FTmM6MP/yDJ3FyVHDxXWMEAwCQ//vDVCDRSTHC5tGCFWEBlaPhH31DAtLwW5JjmRkZH/pD7XlSocCwdkFB/4kjd+CSq