const Moment = require('moment')
const array = [{date:"2018-05-11"},{date:"2018-05-12"},{date:"2018-05-10"}]
const sortedArray = array.sort((a,b) => new Moment(a.date).format('YYYYMMDD') - new Moment(b.date).format('YYYYMMDD'))
console.log(sortedArray)
String.prototype.toPersianDigits = function () { | |
var id = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; | |
return this.replace(/[0-9]/g, function (w) { | |
return id[+w]; | |
}); | |
}; | |
String.prototype.toEnglishDigits = function () { | |
var id = { '۰': '0', '۱': '1', '۲': '2', '۳': '3', '۴': '4', '۵': '5', '۶': '6', '۷': '7', '۸': '8', '۹': '9' }; |
// https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ | |
function buildWaveHeader(opts) { | |
var numFrames = opts.numFrames; | |
var numChannels = opts.numChannels || 2; | |
var sampleRate = opts.sampleRate || 44100; | |
var bytesPerSample = opts.bytesPerSample || 2; | |
var blockAlign = numChannels * bytesPerSample; | |
var byteRate = sampleRate * blockAlign; | |
var dataSize = numFrames * blockAlign; |
#!/bin/bash | |
# from | |
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html | |
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png | |
convert favicon-256.png -resize 16x16 favicon-16.png | |
convert favicon-256.png -resize 32x32 favicon-32.png | |
convert favicon-256.png -resize 64x64 favicon-64.png | |
convert favicon-256.png -resize 128x128 favicon-128.png |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
sudo apt-get install php5.6 | |
php --version | |
sudo apt-get install php5.6-curl php5.6-xml | |
sudo apt-get install composer |
#! Aaaaaaaaaaa this is JS!!! | |
// https://github.com/tc39/proposal-hashbang | |
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics | |
// Enjoy!!! | |
// Created at Nov 23, 2018 | |
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator | |
|> do { // https://github.com/tc39/proposal-do-expressions | |
case(?) { // https://github.com/tc39/proposal-pattern-matching | |
when {val}: class { |
// custom mapbopx-gl-draw mode that modifies draw_line_string | |
// shows a center point, radius line, and circle polygon while drawing | |
// forces draw.create on creation of second vertex | |
import MapboxDraw from 'mapbox-gl-draw'; | |
import numeral from 'numeral'; | |
import lineDistance from 'npm:@turf/line-distance'; | |
const RadiusMode = MapboxDraw.modes.draw_line_string; |
Saved from Archive.org, Date: May 14, 2010 Author: Jesse Webb
Our development machines here at Point2 are not standardized; we have a mixture of Windows XP, 7, and Mac OSX/Unix computers. I find myself constantly switching back and forth between command prompt interfaces when pair programming. As a result, I catch myself using “ls” to list a directories contents regardless of what system I am on. I am currently using a Windows XP machine for my developer box and I wanted to setup an alias to the “ls” command to actually perform a “dir”. Here is how I accomplished it…
There is a command available in a Window’s shell that let’s you “alias” command to whatever you please: DOSKey. It allows you to create “macros” to execute one or more other commands with a custom nam
import { useEffect, useRef } from 'react' | |
// playground: https://stackblitz.com/edit/react-ts-nv5fxe?file=App.tsx | |
export default function App() { | |
// create a ref and declare an instance for each countUp animation | |
const countupRef = useRef(null); | |
let countUpAnim; | |