Skip to content

Instantly share code, notes, and snippets.

View SirM2z's full-sized avatar
๐Ÿ’ช
Tomorrow comes never.

Ryan SirM2z

๐Ÿ’ช
Tomorrow comes never.
View GitHub Profile
const PENDING = 'pending';
const FULFILLED = 'fulfilled';
const REJECTED = 'rejected';
function Promise(executor) {
let self = this;
self.status = PENDING;
self.onFulfilled = [];//ๆˆๅŠŸ็š„ๅ›ž่ฐƒ
self.onRejected = []; //ๅคฑ่ดฅ็š„ๅ›ž่ฐƒ
//PromiseA+ 2.1
function resolve(value) {
const PENDING = 'PENDING';
const FULFILLED = 'FULFILLED';
const REJECTED = 'REJECTED';
class Promise {
constructor(exceutor) {
this.status = PENDING;
this.value = undefined;
this.reason = undefined;
this.onFulfilledCallbacks = [];
const PENDING = "pending";
const RESOLVED = "resolved"; // fulfilled
const REJECTED = "rejected"; //rejected
class Promise {
// ๆž„้€ ๅ‡ฝๆ•ฐๆŽฅๅ—ไธ€ไธชๆ‰ง่กŒๅ™จไฝœไธบๅ‚ๆ•ฐ
constructor(executor) {
// promise ็Šถๆ€
this.status = PENDING;
this.value = undefined;
@SirM2z
SirM2z / formatDate-jstool.js
Created April 19, 2018 06:23
js ๆ—ถ้—ดๆ ผๅผๅŒ–
// value ๅฏ้€‰ new Dateใ€ๆ—ถ้—ดๆˆณใ€"2016-08-05 14:22:09" ๆ—ถ้—ดๆ ผๅผ
// fmt ๅฏ้€‰ ไปฅไธ‹ๆ ผๅผ(ไปฅๅŠไฝ็ฝฎ่ฐƒๆข)
// yyyy-MM-dd hh:mm:ss
// yyyy-MM-dd hh:mm:ss.S
// yyyy/MM/dd hh:mm:ss
// yyyyๅนดMMๆœˆddๆ—ฅ hhๆ—ถmmๅˆ†ss็ง’
// yyyyMMddhhmmss
function formatDate (value, fmt) {
// let v = value.replace(/-/g, "/").substring(0, 19);
let date = new Date(value)
@SirM2z
SirM2z / html5_Notification.js
Last active November 24, 2017 07:29
chrome console snippets
(function() {
const NotificationInstance = Notification || window.Notification;
if (!!NotificationInstance) {
const permissionNow = NotificationInstance.permission;
// 'default' ็”จๆˆท่ฟ˜ๆœช่ขซ่ฏข้—ฎๆ˜ฏๅฆๆŽˆๆƒ๏ผŒๆ‰€ไปฅ้€š็Ÿฅไธไผš่ขซๆ˜พ็คบ
// 'granted' ่กจ็คบไน‹ๅ‰ๅทฒ็ป่ฏข้—ฎ่ฟ‡็”จๆˆท๏ผŒๅนถไธ”็”จๆˆทๅทฒ็ปๆŽˆไบˆไบ†ๆ˜พ็คบ้€š็Ÿฅ็š„ๆƒ้™
// 'denied' ็”จๆˆทๅทฒ็ปๆ˜Ž็กฎ็š„ๆ‹’็ปไบ†ๆ˜พ็คบ้€š็Ÿฅ็š„ๆƒ้™
if (permissionNow === 'granted') {
// ๅ…่ฎธ้€š็Ÿฅ
CreatTask();

Keybase proof

I hereby claim:

  • I am SirM2z on github.
  • I am coolm_z (https://keybase.io/coolm_z) on keybase.
  • I have a public key whose fingerprint is B055 BC1A BD57 C6EF 6D66 5608 3B45 0968 C69D 4172

To claim this, I am signing this object: