Skip to content

Instantly share code, notes, and snippets.

View soyoes's full-sized avatar

soyoes soyoes

  • Evolany Co., Ltd.
  • Tokyo/Japan
View GitHub Profile
<?php
trait DynamicDefinition {
public function __call($name, $args) {
if (is_callable($this->$name)) {
return call_user_func($this->$name, $args);
}
else {
throw new \RuntimeException("Method {$name} does not exist");
}
@soyoes
soyoes / CSS3_Tips.md
Last active April 24, 2017 06:01
CSS3 Tips

Flex box display

element with flex/inline-flex affects its child nodes!

Vertical or horizontal layout child nodes

{display:flex; flex-direction:row;} /*horizontal*/
{display:flex; flex-direction:column;} /*vertical*/
@soyoes
soyoes / file0.txt
Last active September 20, 2016 03:56
PHP 正規表現 上級編 ref: http://qiita.com/soyoes/items/231d2f22d61a5b67b4b9
$pattern = '/foo(?=bar)/';
preg_match($pattern,'Hello foo'); // BAD
preg_match($pattern,'Hello foobar'); // OK
https://faces.fiverr.com
http://urban-walks.com/
http://gameit.us/
https://www.quizup.com/en
@soyoes
soyoes / ios_push
Last active March 31, 2016 02:42
apple push
1: keychain->[Keychain access]->[Certificates Assistants]->[Request ...]->{email:YOURs, Common Name:"APP_NAME PUSH"}->[save to disk] (f1.certSigningRequest)
* DON'T forget to set [Common Name]="APP_NAME PUSH", or you won't find it later
* DON'T through away f1.certSigningRequest, it can be used while renew a year later.
2: dev center->certificates->[Identifiers]->App IDs-> [+] button
-> check enable Push -> [Create Certificate...] -> [continue] -> upload the file of #1 (f1.certSigningRequest) -> [Generate] -> [Download] => you got a "aps_development.cer" file (f2.cer)
* DON'T forget to install f2.cer by double click!
3: keychain->certificates->[your app buldle id]->right click->export ... ->save as f3.p12
* YOU may have to specify a password of at least 4 bit !
4: make PEM file with your f3.p12, u will get cert.pem (a cert pem file)
```Bash
@soyoes
soyoes / OBJC Tips
Last active October 17, 2018 16:46
OBJC Tips
* strong, weak, assign
http://stackoverflow.com/questions/8927727/objective-c-arc-strong-vs-retain-and-weak-vs-assign
* bridge (void* => id, id => void*)
http://stackoverflow.com/questions/18976016/how-to-specify-property-to-c-pointer-in-arc-environment
* arr.indexOf
```Objective-C
//BAD: it returns max int.
(int)[arr indexOfObject:obj]>0
select *
NOT IN
!= //index失効
<> //index失効
is null //index失効, 方法:NOT NULL, default=0, where xxx=0
where OR //index失効失効
改善前:
select id from t where num=10 or num=20
改善後:
select id from t where num=10