Skip to content

Instantly share code, notes, and snippets.

View flxxyz's full-sized avatar
🙏
睡门

一个不知名の睡觉高手 flxxyz

🙏
睡门
View GitHub Profile
@flxxyz
flxxyz / get_safe_filesize.php
Last active August 28, 2018 15:19
读取大于2GB以上的文件
<?php
function get_safe_filesize($file)
{
$size = filesize($file);
if ($size <= 0) {
if (!(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')) {
$size = trim(`stat -c%s $file`);
} else {
$fsobj = new COM("Scripting.FileSystemObject");
$f = $fsobj->GetFile($file);
@flxxyz
flxxyz / drawChessBoard.js
Created September 20, 2018 11:10
五子棋基本模块
var drawChessBoard = function(){
for(var i = 0; i < 15; i++){
context.moveTo(15 + i * 30 , 15);
context.lineTo(15 + i * 30 , 435);
context.stroke();
context.moveTo(15 , 15 + i * 30);
context.lineTo(435 , 15 + i * 30);
context.stroke();
}
}
@flxxyz
flxxyz / Log.php
Last active April 15, 2019 10:06
简易日志记录类
<?php
/**
* Class Log
*
* @package Log
* @method static notice($channel, ...$message)
* @method static info($channel, ...$message)
* @method static debug($channel, ...$message)
* @method static warn($channel, ...$message)
@flxxyz
flxxyz / Db.php
Last active October 25, 2018 03:10
简单封装的PDO操作类
<?php
/**
* Class Db
*/
class Db
{
private static $instance = null;
private $host = '127.0.0.1';
@flxxyz
flxxyz / winning.php
Created January 14, 2019 02:03
简单中奖概率
<?php
$odds = 90; //概率
$success = 0;
$fail = 0;
$i = 0;
while ($i < 100) {
$rnd = mt_rand(0, 99);
@flxxyz
flxxyz / LoginPhone.vue
Last active April 16, 2019 09:34
一个满足基本需求的手机号登录组件
<template>
<div class="login-wrapper">
<div class="title-bar">登录</div>
<div class="wrapper phone-wrapper">
<span class="title">手机号</span>
<input class="input phone" type="text" placeholder="手机号"
:value="phone"
ref="phone" v-on:change="changePhone" v-on:input="changePhone">
</div>
<div class="wrapper code-wrapper">
@flxxyz
flxxyz / App.vue
Last active August 26, 2019 03:06
Vue注册全局指令,实现在标签上编码markdown
<template>
<div id="app">
<Test/>
</div>
</template>
<script>
import Test from './Test'
export default {
@flxxyz
flxxyz / Tween.js
Created September 17, 2019 16:39
常用的运动算法
/*
* Tween.js
* t: current time(当前时间)
* b: beginning value(初始值)
* c: change in value(变化量)
* d: duration(持续时间)
*/
var Tween = {
Linear: function(t, b, c, d) { return c*t/d + b; },
Quad: {
@flxxyz
flxxyz / request.js
Created April 22, 2020 09:26
开箱即用的ajax
! function (e) {
var r,
u,
t = [
'Object',
'Array',
'String',
'Number',
'Boolean',
'Function',
@flxxyz
flxxyz / GetSystemVersionNumber.go
Last active April 9, 2023 05:50
obtain the system version number(windows, linux, darwin or macos)
// golang 获取系统版本号 (windows, linux, darwin or macos)
// golang obtain the system version number (windows, linux, darwin or macos)
package main
import (
"bytes"
"io/ioutil"
"log"
"os"