Skip to content

Instantly share code, notes, and snippets.

Avatar
👿
work work!

OnO flxxyz

👿
work work!
View GitHub Profile
@flxxyz
flxxyz / App.vue
Last active Aug 26, 2019
Vue注册全局指令,实现在标签上编码markdown
View App.vue
<template>
<div id="app">
<Test/>
</div>
</template>
<script>
import Test from './Test'
export default {
@flxxyz
flxxyz / LoginPhone.vue
Last active Apr 16, 2019
一个满足基本需求的手机号登录组件
View LoginPhone.vue
<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 / winning.php
Created Jan 14, 2019
简单中奖概率
View winning.php
<?php
$odds = 90; //概率
$success = 0;
$fail = 0;
$i = 0;
while ($i < 100) {
$rnd = mt_rand(0, 99);
@flxxyz
flxxyz / Db.php
Last active Oct 25, 2018
简单封装的PDO操作类
View Db.php
<?php
/**
* Class Db
*/
class Db
{
private static $instance = null;
private $host = '127.0.0.1';
@flxxyz
flxxyz / Log.php
Last active Apr 15, 2019
简易日志记录类
View Log.php
<?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 / drawChessBoard.js
Created Sep 20, 2018
五子棋基本模块
View drawChessBoard.js
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 / get_safe_filesize.php
Last active Aug 28, 2018
读取大于2GB以上的文件
View get_safe_filesize.php
<?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 / limit_speed_print_file.php
Last active Aug 28, 2018
限制文件读取速度
View limit_speed_print_file.php
<?php
function limit_speed_print_file($filename, $limit_rate = 100)
{
if (file_exists($filename) && is_file($filename)) {
header('Cache-control: private');
header('Content-Type: application/octet-stream');
header('Content-Length: '.get_safe_filesize($filename));
header('Content-Disposition: attachment; filename='
.basename($filename));
header('Content-Transfer-Encoding: binary');
@flxxyz
flxxyz / xdec.php
Last active Jul 10, 2018
自定义多进制很骚
View xdec.php
<?php
/**
* 自定义多进制
* @param $str 自定义的多进制字符串
* @param $num 十进制数字
* @return string
* @author alexander_phper
* @link https://blog.csdn.net/alexander_phper/article/details/51363491
*/
function xdec($str, $num){
@flxxyz
flxxyz / Config.php
Last active Jul 7, 2018
自用简易控制器
View Config.php
<?php
namespace App;
class Config
{
private static $name = '';
private static $arr = [];
/**
* @return array
*/
public static function getArr()
You can’t perform that action at this time.