Skip to content

Instantly share code, notes, and snippets.

View yousan's full-sized avatar
💻
I must work everyday

Yousan_O yousan

💻
I must work everyday
View GitHub Profile
@BugRoger
BugRoger / ssh-background
Created January 21, 2011 16:02
Changes iTerm2's background color based on host configuration
#!/bin/bash
# Installation:
# 1. Save this script to /some/bin/ssh-background
# 2. chmod 755 /some/bin/ssh-background
# 3. alias ssh=/some/bin/ssh-background
# 4. Configure your host colors below.
set_color() {
local HEX_FG=$1
local HEX_BG=$2
@k-holy
k-holy / LoaderTest.php
Created August 5, 2011 06:42
PSR-0対応クラスローダ試案
<?php
namespace Holy\Tests;
use Holy\Loader;
/**
* LoaderTest
*
* @author k.holy74@gmail.com
*/
@miya0001
miya0001 / class-addrewriterules.php
Created September 30, 2011 15:02
WPに任意のURLを追加するためのクラス
<?php
if (!class_exists('WP_AddRewriteRules')):
class WP_AddRewriteRules{
private $rule = null;
private $query = null;
private $callback = null;
function __construct($rule, $query, $callback)
{
@miya0001
miya0001 / class-addpage.php
Created March 3, 2012 13:27
WordPressに独自のページを表示する
<?php
if (!class_exists('WP_AddPage')):
class WP_AddPage {
private $rule = null;
private $title = null;
private $callback = null;
private $template = null;
private $filter = false;
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@raphaelstolt
raphaelstolt / php54_php53_pear_macports.markdown
Created May 17, 2012 21:37
Installing PHP 5.4 and 5.3 side by side on Max OSX via MacPorts

##Given Apache 2 and MySQL are already installed.

#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated

#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules

@Gab-km
Gab-km / github-flow.ja.md
Last active April 25, 2024 04:01 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@rummelonp
rummelonp / zsh_completion.md
Last active February 22, 2023 15:06
zsh の補完関数の自作導入編

zsh の補完関数の自作導入編

あまり深く理解してないので識者のツッコミ大歓迎

補完を有効にする

取り敢えず最低限だけ

# 補完を有効にする
@adrienbrault
adrienbrault / guzzle.php
Created April 8, 2013 16:40
Download a file using guzzle
<?php
$client = ...;
$response = $client->get('http://guzzlephp.org/index.html', null, tmpfile())->send();
$response->getStream(); // Magic comes after
@keithics
keithics / gist:5398349
Created April 16, 2013 18:32
Get post by Slug - Wordpress
function get_post_by_slug($post_name) {
global $wpdb;
$post = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s", $post_name));
return $post ? get_post($post) : NULL;
}