Skip to content

Instantly share code, notes, and snippets.

Avatar

Hiroshi Sawai s-hiroshi

View GitHub Profile
@s-hiroshi
s-hiroshi / wp-class-custom-header-setup.php
Last active Apr 29, 2016
WordPressのカスタムヘッダー(custom header)登録サンプルです。
View wp-class-custom-header-setup.php
<?php
/**
* カスタム
*
* @package InfoTown
* @author Hiroshi Sawai <info@info-town.jp>
* @copyright Hiroshi Sawai
*/
class MyTheme_SetUp {
/**
@benlk
benlk / 0-toc.md
Last active Oct 28, 2021
Collection of notes on WP_UnitTestCase
View 0-toc.md
  1. Table of contents
  2. General information
    1. Terms
    2. General structure of a test
    3. WordPress-specific assertions and test functions
      • enqueues
      • creating posts
      • creating terms
      • attaching images
      • ?
@orendon
orendon / git_tag_timestamp.sh
Last active Jan 8, 2021
Git tag timestamp
View git_tag_timestamp.sh
#git tag `date "+staging-%Y%m%d%H%M%S"`
git tag `date "+production-%Y%m%d%H%M%S"`
git push --tags
@DaRaFF
DaRaFF / ubuntu-php-development-environment.md
Last active Sep 26, 2021
Ubuntu php development environment
View ubuntu-php-development-environment.md

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@s-hiroshi
s-hiroshi / README.md
Last active Apr 27, 2018
jQuery > snippet > dropdown
View README.md

Condition

gte IE 8 and firefox, chrome, safari, opera latest version

Usage

<link rel="stylesheet" href="style.css" media="all">
<script src="jquery.js"></script>
View gist:1599791
function HTML_format(original_HTML){
var o = original_HTML,
match;
o = o.replace(/<div><\/div>/g,'')
// todo: replace div block inside div block, now we only deal with one-layer nesting
// method: a,b find bs see if the one before is a, if it is. eliminate them both
o = o.replace(/^(<div>)+/g,'');
@elebescond
elebescond / gist:1433137
Created Dec 5, 2011
Generate a pot template from a wordpress theme - xgettext
View gist:1433137
find . -iname "*.php" > /tmp/my_theme_file_list.txt
# new template
xgettext --from-code=utf-8 -d my_theme -f /tmp/my_theme_file_list.txt --keyword=__ -o languages/my_theme.pot
# update template
xgettext --from-code=utf-8 -d my_theme -j -f /tmp/my_theme_file_list.txt --keyword=__ -o languages/my_theme.pot
@sente
sente / formatXML.js
Last active Nov 23, 2021
javascript to format/pretty-print XML
View formatXML.js
The MIT License (MIT)
Copyright (c) 2016 Stuart Powers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@isaacs
isaacs / comma-first-var.js
Created Apr 6, 2010
A better coding convention for lists and object literals in JavaScript
View comma-first-var.js
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
View SplClassLoader.php
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,