Skip to content

Instantly share code, notes, and snippets.

View qwqcode's full-sized avatar
👋
hi

qwqcode qwqcode

👋
hi
  • Hangzhou, China
  • 10:24 (UTC +08:00)
View GitHub Profile
let 起床时间 = 8; // 本来是早上 8 点起床
let 睡觉时间 = 22; // 晚上 10 点睡觉
while (true) {
很晚才起床();
console.log(`当 ${(睡觉时间>=24)?'第二天 '+(睡觉时间%24):睡觉时间} 点睡,起床时间为 ${起床时间}`);
if (睡觉时间 > 24 && 睡觉时间 % 24 >= 8) {
console.log("不用睡觉了,好耶!😆")
break; // 如果到第二天 8 点,那不用睡觉了,程序结束
package main
import (
"fmt"
"time"
)
var c = make(chan string, 2)
func main() {
@qwqcode
qwqcode / php闭包.php
Created October 7, 2017 14:11
php 闭包
function getCategories(Request $request, Response $response, $args) {
$categoriesTable = $this - >tableCategory();
$withBooks = $request - >getParam('withBooks');
$data = [];
foreach($categoriesTable - >get() as $num = >$item) {
$data[$num] = [];
foreach($item as $key = >$value) $data[$num][$key] = $value;
@qwqcode
qwqcode / ObjectTest.php
Created October 7, 2017 13:30
Object Test
class Ha {
function __construct() {
// 1. Look there
$action = new Action();
$action->setMsg("你好世界");
$this->handleActionObj($action, "Hello World");
echo $action->getMsg();
}
function handleActionObj(Action $actionObj, $msg) {
@qwqcode
qwqcode / testPointerA.java
Created September 17, 2017 05:56
关于 JAVA 指针
public class testPointerA {
public static void main(String[] agrs) {
new a();
b classB = new b();
classB.init();
classB.action();
c classC = new c();
classC.cAction();
}
@qwqcode
qwqcode / throw-test.js
Created July 25, 2017 03:54
About JS throw()
var err = false;
var ha = function () {
if (err) {
throw("Error!!!");
}
console.log("ha");
};
var do = function () {
ha();
console.log("do");