Skip to content

Instantly share code, notes, and snippets.

View Muhammad-Altabba's full-sized avatar

Muhammad Altabba Muhammad-Altabba

View GitHub Profile
@Muhammad-Altabba
Muhammad-Altabba / vrpsolver.py
Last active February 4, 2019 06:43 — forked from ilaif/vrpsolver.py
VRP (Vehicle Routing Problem) Solver using OR-Tools library in python
from ortools.constraint_solver import pywrapcp
from ortools.constraint_solver import routing_enums_pb2
import argparse
import json
import sys
is_debug = False
class CreateDistanceCallback(object):
@Muhammad-Altabba
Muhammad-Altabba / timepan.ts
Last active January 23, 2019 23:32 — forked from ranwahle/timepan.ts
.Net-like timespan class in TypeScript
const MILLISECONDS_IN_A_SECOND = 1000;
const SECONDS_IN_A_MINUTE = 60;
const MINUTES_IN_AN_HOUR = 60;
const HOURS_IN_A_DAY = 24;
const DAYS_IN_A_WEEK = 7;
const MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
const MILLISECONDS_IN_AN_HOUR = MILLISECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR;
const MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_AN_HOUR * HOURS_IN_A_DAY;
const MILLISECONDS_IN_A_WEEK = MILLISECONDS_IN_A_DAY * DAYS_IN_A_WEEK;
@Muhammad-Altabba
Muhammad-Altabba / Contract_calls.sol
Last active February 20, 2024 10:45 — forked from critesjosh/Contract_calls.sol
CALL vs CALLCODE vs DELEGATECALL in Solidity
pragma solidity ^0.5.0;
contract C1 {
uint public num;
address public sender;
function callSetNum(address c2, uint _num) public {
(bool res,) = c2.call(abi.encodePacked(bytes4(keccak256("setNum(uint256)")), _num));
if(!res) revert(); // C2's num is set
}