This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
/** | |
* @typedef { Object } UploadMeta | |
*/ | |
/** | |
* @typedef { Object } UploadResponse | |
*/ | |
/** | |
* @typedef { import('@uppy/core').Uppy<UploadMeta, UploadResponse> } TypedUppy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BulkUpdatable | |
extend ActiveSupport::Concern | |
class_methods do | |
def bulk_update(attributes) | |
return true if attributes.empty? | |
attrs = attributes.map { |attribute| attribute.to_h.symbolize_keys } | |
fields = attrs.first.keys.map(&:to_sym) - [:id] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ログインボタンを押した時のアクションは自分で設定する | |
@IBAction func twitterLoginButtonTapped(sender: AnyObject) { | |
MBProgressHUD.showHUDAddedTo(self.view, animated: true) | |
} | |
// Twitterログインボタン設定 | |
func setupLoginWithTwitter() { | |
// Consumer Key, Consumer Secretの指定 | |
NCMBTwitterUtils.initializeWithConsumerKey(kTwitterConsumerKey, consumerSecret: kTwitterConsumerSecret) | |
// Twitterログインボタン押下時の処理 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('AppModel', 'Model'); | |
class ArrayModel extends AppModel { | |
public $useDbConfig = 'array'; | |
public $useTable = false; | |
public $records = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Model\Entity; | |
use Cake\ORM\Entity; | |
use Cake\Auth\DefaultPasswordHasher; | |
/** | |
* SiteAdminUser Entity. | |
* | |
* @property int $id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach (range(1, 10) as $n) { | |
echo "calculating $n connection...\n"; | |
$c = new Connection($n, $n === 1 ? null : $c); | |
echo 'got answer. connection patterns: ', count($c->answers), "\n"; | |
} | |
class Connection { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// モデルの場合。 | |
// 以下と相似なヘルパーメソッドを作れば、いちいち同じようなメソッドを大量生産しなくて済むよ! | |
class Post extends AppModel { | |
public function edit($id, $data) { | |
$this->create(false); | |
$this->set($data); | |
$this->set('id', $id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class M4ec9e1ac040840e8b4383c94d8a96c37 extends CakeMigration { | |
/** | |
* Records keyed by model name. | |
* | |
* @var array $records | |
*/ | |
public $records = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('Component', 'Controller'); | |
App::uses('Inflector', 'Utility'); | |
class BaseActionComponent extends Component { | |
public $components = array('Session'); | |
public $Controller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public $components = array( | |
'RequestHandler' => array( | |
// 'enabled' => false, | |
), | |
'DebugKit.Toolbar' => array( | |
'history' => 5, | |
'panels' => array( | |
'Interactive.interactive', | |
), |
NewerOlder