Skip to content

Instantly share code, notes, and snippets.

<?php
class StoreController extends AppController
{
public function buy()
{
$customer = Customer::get(Param::get('customer_id'));
$store = Store::get(Param::get('store_id'));
$item = Item::get('item_id'));
try {
@ha1t
ha1t / testfile.php
Created February 1, 2013 06:28
test
<?php
phpinfo();
@ha1t
ha1t / dc_debug.php
Last active December 15, 2015 09:09
#!/usr/bin/php
<?php
/**
* dietcakeのdebug.logを見るコマンド
*
*/
// 対象のディレクトリがdietcake案件のものか調べてプロジェクトルートを返す
function get_project_dir($dir)
{
@ha1t
ha1t / deep_copy.php
Last active December 18, 2015 21:09
PHPオブジェクトにおける、シャローコピーとディープコピー
<?php
class Player extends stdClass
{
public function __clone()
{
$this->status = clone $this->status;
}
}
$player = new Player();
@ha1t
ha1t / gist:5964797
Last active December 19, 2015 13:49
$ sudo sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +27.8°C (crit = +101.0°C)
temp2: +29.8°C (crit = +101.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +46.0°C (high = +86.0°C, crit = +100.0°C)
# aliases
# in this example you can open extensions page by the command ':ext'
# and Chrome's option page by the command ':option'
alias ext TabOpenNew chrome://extensions/
alias option TabOpenNew chrome://settings/browser
alias downloads TabOpenNew chrome://downloads
alias history TabOpenNew chrome://history
alias pop WinOpenNew --pop
## pagecmd offers you page specific key mapping.
@ha1t
ha1t / array_walk_test.php
Created August 11, 2013 06:39
array_walk() to destroy the internal array pointer
<?php
echo phpversion() . PHP_EOL;
$lists = array('hoge');
array_walk($lists, 'trim');
if (current($lists) !== false) {
echo 'o';
} else {
echo 'x';
}
@ha1t
ha1t / uninstall_bitcasa.sh
Last active December 22, 2015 01:29
delete preference for bitcasa
sudo rm -rf /Applications/Bitcasa.app
rm -f ./Library/Preferences/com.bitcasa.Bitcasa.plist
rm -f ./Library/Preferences/Bitcasa.SIMBLAgent.plist
rm -rf ./Library/Application\ Support/com.bitcasa.Bitcasa
rm -rf ~/Library/Caches/com.bitcasa.*
rm -r ~/Library/LaunchAgents/com.bitcasa.Bitcasa.plist
@ha1t
ha1t / crafter.c
Last active January 2, 2016 06:49
// エレクトラムインゴット CP287
void create_40() {
comfart_zone();
inner_quiet();
stedy_hand2();
manipulation();
kakou();
kakou();
kakou();
heisty_touch();