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 | |
// Here your code ! | |
print("hoge"); | |
?> |
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
func main() { | |
args := os.Args | |
if len(args) <= 1 { | |
log.Fatal("Usage: ", path.Base(args[0]), " anything") | |
} | |
fmt.Println("len: ", len(args), " values: ", args) | |
} |
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
func main() { | |
args := os.Args | |
if len(args) != 2 { | |
log.Fatal("Usage: ", path.Base(args[0]), " filename") | |
} | |
if _, err := os.Stat(args[1]); err == nil { | |
fmt.Println("File exists") | |
} else { | |
fmt.Println("File not found.") | |
} |
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
func main() { | |
args := os.Args | |
if len(args) != 2 { | |
log.Fatal("Usage: ", path.Base(args[0]), " dir") | |
} | |
files, _ := ioutil.ReadDir(args[1]) | |
for _, f := range files { | |
fmt.Println(f.Name()) | |
} | |
} |
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
func main() { | |
args := os.Args | |
if len(args) != 2 { | |
log.Fatal("Usage: ", path.Base(args[0]), " file") | |
} | |
data, err := ioutil.ReadFile(args[1]) | |
if err != nil { | |
log.Fatal(err) | |
} |
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
func main() { | |
args := os.Args | |
if len(args) != 3 { | |
log.Fatal("Usage: ", path.Base(args[0]), " filename text") | |
} | |
data := []byte(args[2]) | |
err := ioutil.WriteFile(args[1], data, 0644) | |
if err != nil { | |
log.Fatal(err) |
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
func main() { | |
now := time.Now() | |
fmt.Println("now: ", now) | |
fmt.Println("now: ", now.Format("20060102")) // YYYYMMDD | |
fmt.Println("now: ", now.Format("20060102150405")) //YYMMDDhhmmss | |
} |
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
func main() { | |
args := os.Args | |
if len(args) < 2 { | |
log.Fatal("Usage: ", path.Base(args[0]), " cmd") | |
} | |
out, err := exec.Command(args[1], args[2:]...).Output() | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Println("Out: ", string(out)) |
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
func main() { | |
args := os.Args | |
if len(args) != 2 { | |
log.Fatal("Usage: ", path.Base(args[0]), " number") | |
} | |
if val, err := strconv.Atoi(args[1]); err != nil { | |
log.Fatal(err) | |
} else { | |
fmt.Println("val: ", val) | |
} |
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\Validation; | |
use Cake\Validation\Validation; | |
class CustomValidation extends Validation | |
{ | |
public static function imageSize($check, $width, $height) | |
{ | |
$size = getimagesize($check['tmp_name']); |
OlderNewer