Skip to content

Instantly share code, notes, and snippets.

MaySnow MaySnow

Block or report user

Report or block MaySnow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MaySnow
MaySnow / dio_ singleton.dart
Last active Jul 22, 2019
#flutter dio封装,添加公用header,以及公用配置
View dio_ singleton.dart
import "package:dio/dio.dart";
import 'package:my_demo/utils/config.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class HttpUtil {
static final HttpUtil _instance = HttpUtil._internal();
Dio _client;
FlutterSecureStorage _storage;
@MaySnow
MaySnow / flutter_staggered_grid_view_image_fixed.dart
Created Jul 18, 2019
#flutter #image flutter_staggered_grid_view 初始加载,图片的宽高固定
View flutter_staggered_grid_view_image_fixed.dart
class _HomeTabState extends State<HomeTab> {
List<ImageList> _imgList = List<ImageList>();
ScrollController _scrollController = ScrollController();
bool isPerformingRequest = false;
@override
void initState() {
super.initState();
@MaySnow
MaySnow / shopCart.dart
Last active Dec 3, 2019
#flutter shop cart
View shopCart.dart
import 'package:flutter/material.dart';
// 购物车
class Product {
const Product({this.name});
final String name;
}
typedef void CartChangedCallback(Product product, bool inCart);
class ShoppingListItem extends StatelessWidget {
@MaySnow
MaySnow / infinite_dynamic_listview.dart
Last active Jul 17, 2019
#flutter infinite dynamic listview
View infinite_dynamic_listview.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
@MaySnow
MaySnow / strLength.js
Last active Dec 29, 2015
带中文字符串的字节数
View strLength.js
String.prototype.chinaLength = function() {
var result = this.match(/[\u0080-\uFFE5]/g);
if (result) {
return this.length + result.length;
}
return this.length;
}
@MaySnow
MaySnow / gist:3889081
Created Oct 14, 2012
基于注解,级联删除
View gist:3889081
import javax.persistence.CascadeType;//注意jar包
cascade={CascadeType.REMOVE}
@MaySnow
MaySnow / gist:3864591
Created Oct 10, 2012
一个层悬浮于另一个层上面
View gist:3864591
一个层position:absolute
一个层 position: relative;
然后再根据z-index控制谁在上面
@MaySnow
MaySnow / prover.js
Created Oct 10, 2012
点击body隐藏某个模块,并防止事件冒泡
View prover.js
$("body").live("click",function(){
$(".toptask").hide();
});
//新建任务的模块防止事件冒泡
$(".toptask").live("click",function(event){
event.stopPropagation();
});
@MaySnow
MaySnow / random.java
Created Oct 9, 2012
随机产生字符串
View random.java
package com.kaishengit;
import java.util.Random;
import java.util.TimeZone;
import com.kaishengit.pojo.User;
import com.kaishengit.util.DateUtil;
import hirondelle.date4j.DateTime;
@MaySnow
MaySnow / gson.js
Created Oct 9, 2012
gson 解析 javascript
View gson.js
var date = [{"name":"不错"},{"name":"全选"},{"name":"还好"},{"name":"你好"}]
for(var i = 0 ; i < date.length; i ++) {
date[i].name//得到每个name值
}
You can’t perform that action at this time.