Skip to content

Instantly share code, notes, and snippets.

View parse-code's full-sized avatar
:octocat:
Working

Parse parse-code

:octocat:
Working
View GitHub Profile
@parse-code
parse-code / date_formate.js
Last active June 25, 2019 08:33
[JS 时间格式化]
Date.prototype.format = function(fmt) {
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};
@parse-code
parse-code / async.dart
Created June 18, 2019 09:46
[Flutter redux async] #Flutter
import 'package:flutter/material.dart';
import 'package:redux/redux.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:redux_thunk/redux_thunk.dart';
import 'dart:convert'; // to convert Response object to Map object
import 'package:http/http.dart' as http;
// AppState
class AppState {
int _counter;
@parse-code
parse-code / redux.dart
Last active June 18, 2019 08:55
[Flutter redux] #Flutter #Redux
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:redux/redux.dart';
enum Actions { Increment, Decrement, Reset }
class AppState {
final int count;
AppState({this.count = 0});
}
@parse-code
parse-code / layout.dart
Created June 18, 2019 01:43
[Flutter Layout Cheat Sheet] #Flutter #Layout #Dart
Row /*or Column*/(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Icon(Icons.star, size: 50),
Icon(Icons.star, size: 50),
Icon(Icons.star, size: 50),
],
),
https://press.one/p/address/v?s=c5f8bba47e644f65b9b769e8b5284109b7a9d6515c9215494c9327999ae8dace4ec30ed46ece9862eeae83edaeee75079d123ecb4a7e27d66d5446b906d866a21&h=39eef1815a073bcbaeeda03a10092bfdc04f2893bf5cc7d5423e247b1b8a3d48&a=ea40ba38530d70541390d8741a758113f21d92f4&f=P1&v=2
@parse-code
parse-code / Class.js
Created January 25, 2012 15:21
CommonJS Class
define(function(require,exports,module){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
var Class = function(){};
// Create a new Class that inherits from this class
Class.extend = function(prop) {
var _super = this.prototype;
// Instantiate a base class (but only create the instance,