Skip to content

Instantly share code, notes, and snippets.

View s-hiroshi's full-sized avatar

Hiroshi Sawai s-hiroshi

View GitHub Profile
@tlxue
tlxue / gist:1599791
Created January 12, 2012 10:38
HTML Format
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,'');
@s-hiroshi
s-hiroshi / wp-class-custom-header-setup.php
Last active April 29, 2016 22:45
WordPressのカスタムヘッダー(custom header)登録サンプルです。
<?php
/**
* カスタム
*
* @package InfoTown
* @author Hiroshi Sawai <info@info-town.jp>
* @copyright Hiroshi Sawai
*/
class MyTheme_SetUp {
/**
@s-hiroshi
s-hiroshi / README.md
Last active April 27, 2018 20:22
jQuery > snippet > dropdown

Condition

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

Usage

<link rel="stylesheet" href="style.css" media="all">
@elebescond
elebescond / gist:1433137
Created December 5, 2011 10:24
Generate a pot template from a wordpress theme - xgettext
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
@benlk
benlk / 0-toc.md
Last active March 29, 2023 13:13
Collection of notes on WP_UnitTestCase
  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 September 12, 2023 13:05
Git tag timestamp
#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 October 13, 2023 00:16
Ubuntu php development environment

#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

@sente
sente / formatXML.js
Last active April 4, 2024 12:20
javascript to format/pretty-print XML
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:
@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
Add MIT license.
<?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,
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// 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",