Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
;;; inao-mode.el --- major mode for writing inao manuscripts | |
;; Copyright (C) 2010 SAKURAI Masashi | |
;; Author: SAKURAI Masashi <m.sakurai at kiwanami.net> | |
;; Keywords: outlines, convenience | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or |
(require 'cl) | |
(require 'popup) | |
(defvar popup-color-string | |
(let ((x 9) (y 3)) | |
(mapconcat 'identity | |
(loop with str = (make-string x ?\ ) repeat y collect str) | |
"\n")) | |
"*String displayed in tooltip.") |
<?php | |
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/Elastica/lib')); | |
function elasticsearch_autoload($class) { | |
$file = str_replace('_', '/', $class) . '.php'; | |
require_once $file; | |
} | |
spl_autoload_register('elasticsearch_autoload'); | |
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__))); |
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Pod::Usage; | |
use Text::Markdown 'markdown'; | |
use HTML::TreeBuilder; | |
use List::Util 'max'; |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
// モデルの場合。 | |
// 以下と相似なヘルパーメソッドを作れば、いちいち同じようなメソッドを大量生産しなくて済むよ! | |
class Post extends AppModel { | |
public function edit($id, $data) { | |
$this->create(false); | |
$this->set($data); | |
$this->set('id', $id); |
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Pod::Usage; | |
use Text::Markdown 'markdown'; | |
use HTML::TreeBuilder; | |
use List::Util 'max'; |
require 'formula' | |
class Emacs < Formula | |
homepage 'http://www.gnu.org/software/emacs/' | |
url 'http://ftpmirror.gnu.org/emacs/emacs-24.1.tar.bz2' | |
mirror 'http://ftp.gnu.org/pub/gnu/emacs/emacs-24.1.tar.bz2' | |
sha1 'ab22d5bf2072d04faa4aebf819fef3dfe44aacca' | |
if ARGV.include? "--use-git-head" | |
head 'http://git.sv.gnu.org/r/emacs.git' |
<?php | |
class AppShell extends Shell { | |
public function progressBar($current, $total, $size = 50) { | |
$perc = intval(($current / $total) * 100); | |
for ($i = strlen($perc); $i <= 4; $i++) { | |
$perc = ' ' . $perc; | |
} | |
$total_size = $size + $i + 3; |