Skip to content

Instantly share code, notes, and snippets.

💻
Focusing on a nodejs project

Ali Torki ali-master

💻
Focusing on a nodejs project
Block or report user

Report or block ali-master

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
@ali-master
ali-master / README.md
Created May 4, 2019
Identify and validate Iranian's sheba code
View README.md

Usage

identifyIBAN("IR320700001000117163068001"); // { isVerify: true, bankName: 'بانک قرض الحسنه رسالت' }
@ali-master
ali-master / README.md
Last active Apr 24, 2019
Update Snappfood order page
View README.md

Install

  1. Install the tampermonkey extension.
  2. Add this hack into your scripts
  3. Go to snappfood.com and then click on an order in orders page.
  4. Open the browser console
  5. Call one of these functions in console

Change date

updateDate("۱۳۹۸/۰۱/۱۲");
@ali-master
ali-master / hexToRgb.js
Created Jan 8, 2019
Convert Hex color code to RGB and vice versa.
View hexToRgb.js
function hexToRgb(hex) {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i
hex = hex.replace(shorthandRegex, (m, r, g, b) => r + r + g + g + b + b)
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
return result
? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
@ali-master
ali-master / move.js
Created Jan 8, 2019
Moves an array item from one position in an array to another.
View move.js
/* #move - Moves an array item from one position in an array to another.
Note: This is a pure function so a new array will be returned, instead
of altering the array argument.
Arguments:
1. array (String) : Array in which to move an item. (required)
2. moveIndex (Object) : The index of the item to move. (required)
3. toIndex (Object) : The index to move item at moveIndex to. (required)
*/
function move(array, moveIndex, toIndex) {
let item = array[moveIndex]
@ali-master
ali-master / pm2.json
Created Oct 3, 2018 — forked from MikeNats/pm2.json
using PM2 for run ES6 (babel) application
View pm2.json
{
"apps": [{
"name": "Application",
"exec_interpreter": "./node_modules/babel-cli/bin/babel-node.js",
"script": "./bin/www",
"args": [],
"watch": ["public", "package.json", "pm2.development.json"],
"ignore_watch": ["public"],
"watch_options": {
"persistent": true,
@ali-master
ali-master / react-children-add-props.js
Created Jun 2, 2018
Adding props to react component children.
View react-children-add-props.js
let props = {
currentStep: this.state.step + 1,
totalSteps: this.props.children.length,
nextStep: this.nextStep.bind(this),
previousStep: this.previousStep.bind(this),
goToStep: this.goToStep.bind(this),
firstStep: this.firstStep.bind(this),
lastStep: this.lastStep.bind(this),
}
@ali-master
ali-master / highcharts-crosses-missing-value.js
Created May 3, 2018
Show crosses for missing values in highcharts
View highcharts-crosses-missing-value.js
/**
* Highcharts plugin to draw crosses for null points
*/
(function(H) {
H.wrap(H.Series.prototype, "drawPoints", function(proceed) {
var series = this,
points = this.points,
renderer = this.chart.renderer;
proceed.call(this);
@ali-master
ali-master / destructuring.js
Created Dec 3, 2017 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
View destructuring.js
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@ali-master
ali-master / unistore.js
Created Oct 22, 2017 — forked from developit/unistore.js
dead simple centralized state container ("store"), with preact bindings.
View unistore.js
import { h, Component } from 'preact';
/** Creates a new store, which is a tiny evented state container.
* @example
* let store = createStore();
* store.subscribe( state => console.log(state) );
* store.setState({ a: 'b' }); // logs { a: 'b' }
* store.setState({ c: 'd' }); // logs { c: 'd' }
*/
You can’t perform that action at this time.